A Stack is a LIFO
(Last In First Out) Data structure - like a stack of plates being
washed - a new plate gets placed on the top of the stack, and if
one is removed, it is also removed from the top.
With every stack there is a stack pointer showing where the top of the stack is.
Example : The diagram shows a stack with three
data items
already in it. :
8 |
|
STACK
POINTER = 3 |
7 |
|
6 |
|
5 |
|
4 |
|
3 |
TODDS |
2 |
JONES |
1 |
GUDRUNSON |
|