- The behavior of a stack
- a list of items that are
accessible at only one end
of the list.
- items are added (PUSH)
or deleted (POP) from the list
only at the top of the stack.
- last in first out (LIFO)
- The STL stack container is an
adapter class, because it uses either
a vector, deque,
or list to implement the behavior of a
stack.
- Since we do not use a stack to insert or delete any
item at any position other than top,
there is little benefit using a list to store the stack's elements.
- The deque manages memory more efficiently than a
vector.
- Write your own stack class and click
here to see the description.