Introduction to Stacks
The stack data structure keeps lists of elements in a manner where the last item received is the item at the top (or first item out) of the stack. This servicing scheme is called LIFO (last in-first out).
While we may not be real familiar with this operating order (except in Jesus' parable of the owner of the vineyard and his hiring practices), this manner of service occurs frequently in computer science.
For example, the following sequence of operations behave as a stack:
Function calls (including recursion)
Interrupts
Some searching algorithms
And more .....
In addition to constructors, the destructor, an assignment operator, etc, typically stacks have the member functions push() and pop(). Push() puts element into the stack, and pop() takes one out.
Examples: Below is a stack (of characters) with three elements. It was create with the code:
myStack.push('g');
myStack.push('y');
myStack.push('c');

