Stack
Only the top is reachable. The last thing down is the first thing up.
Stack: Push, pop, peek
An empty stack. Only the TOP is ever touched, by both push and pop.
Cost
- Push
- O(1)
- Pop
- O(1)
- Peek
- O(1)
- Search
- O(n)
- Space
- O(n)
Before this
Related
Leads to
Topics that need this one first.
Taught by the same lesson
Stack covers these too, in the same run.