=====data Keyword 2===== Queue Dequeuing Operation ====Definition==== Removes and returns the object at the beginning of the Queue (Represents a first-in, first-out collection of objects). Often referred to as a head-tail linked list. ====References==== * http://msdn.microsoft.com/en-us/library/system.collections.queue.dequeue(v=vs.71).aspx * http://en.wikipedia.org/wiki/Double-ended_queue * http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Frzajq%2Frzajqdequeue.htm =====stack data structure Phase 2===== ====Definition==== A stack is a very important part in computer science, especially in the programming field. This could be helpful in many functions even like a simple yet probably not widely used function, reversing a string. Its simple but if we didn't use a stack, it would seem mildly difficult. A stack is like a deck of playing cards, you place one card down and continue stacking cards on top. Then when you are ready, you take the top card off and continue on down. Thats how a stack works, push stuff in and pop stuff off, LIFO (Last in, First out). ====References==== * http://simple.wikipedia.org/wiki/Stack_(data_structure) ====Demonstration==== *** NOT FINISHED, PARTIALLY WORKING CODE *** #include #include int size(int a[]); int push(int a[]); int pop(int a[]); int a[999]; int main() { int input, num; printf("\nStack Operations\n"); printf("----------------------\n"); printf("0. Set Size\n"); printf("1. Push\n"); printf("2. Pop\n"); printf("9. Quit\n"); printf("Your Selection: "); scanf("%d", &input); while (input != 9) { if (input == 0) { size(a); } else if (input == 1) { push(a); } else if (input == 2) { pop(a); } else if (input == 9) { return (1); } printf("\nStack Operations\n"); printf("----------------------\n"); printf("0. Set Size\n"); printf("1. Push\n"); printf("2. Pop\n"); printf("9. Quit\n"); printf("Your Selection: "); scanf("%d", &input); } return (0); } int size(int a[]) { int i = 0; int size; printf("\nEnter Stack Size (0 for unlimited): "); // Sizing array scanf("%d", &size); if (size > 0) { printf("Stack Size Set to: %d\n", size); return (0); } else { printf("Please Enter Appropriate Stack Size\n"); return; } } int push(int a[]) { int i = 0, num; int size; if (i >= size) { printf("*STACK OVERFLOW*\n"); return; } else { if (i <= size) { printf("Enter Value To Push Onto Stack: "); scanf("%d", &num); a[i++] = num; printf("A %hhd Has Been Pushed Onto The Stack\n", num); } } } int pop(int a[]) { int i = 0, num; int size; if (i > 0) { printf("A %hhd Has Been Popped Off Of The Stack\n", a[i]); i--; } else { printf("*STACK UNDERFLOW*\n"); } }