Part II · Linear Data Structures and Core Collections
12. Stacks and Stack-Based Algorithms
7 lessons•38 topics•Beginner / Intermediate
7 of 7 lessons published
12.015 animated
Stack model
- LIFO
- Abstract data type
- Push
- Pop
- Peek
- IsEmpty
- Underflow
- Fixed vs resizable stack
12.021 animated
Implementations
- Array stack
- Linked list stack
- ArrayDeque in Java
- Why legacy Stack is usually avoided
12.036 animated
Expression problems
- Balanced parentheses
- Multi-bracket matching
- Infix-to-postfix
- Infix-to-prefix
- Postfix evaluation
- Operator precedence
12.045 animated
Monotonic stacks
- Next greater/smaller
- Previous greater/smaller
- Stock span
- Daily temperatures
- Largest rectangle in histogram
12.054 animated
Stack simulation
- Undo/redo
- Browser history
- Function calls
- DFS with explicit stack
- Backtracking with stack
12.065 animated
Special stacks
- Min stack
- Max stack
- Two stacks in one array
- Stack using queues
- Sorted stack
12.074 animated
Classic stack patterns
- Remove adjacent duplicates
- Asteroid collision
- Simplify path
- Decode string
- Celebrity problem