Stack
- Tags
- comp-sci
Is a data structure where only the top element is accessible. Adding an element pushes it to the top of the stack and removing an element removes it from the top of the stack. Think of a [see page 5, stack] as in a stack of plates with a last in, first out policy.
Method | Description |
---|---|
Push(S, x) | Add x to the stack S . |
Pop(S) | Remove and return the element at the top of the stack. |
Stack-Empty(S) | Assert wether the stack is empty or not. |
S.top | Pointer to the element at the top of the stack array. |