GCSE Link: None

A stack is a static abstract data type which stores a sequence of items.

But while queues use first in first out (FIFO), stacks use last in first out (LIFO).


These are the main operations on a stack:


Stacks are generally depicted vertically, and we use the terms "bottom" and "top" of the stack to mean the start and end of the underlying array.


One common use of stacks is the call stack, which is explained in 9.07 (Recursion).



What are some other uses of stacks?

E.g., for browser histories (in the back button), or for undo sequences.