stacks
Stacks & Queues
Two structures that differ by one decision.
01 play_circle 02 play_circle 03 play_circle 04 play_circle 05 play_circle
Stack
Last in, first out. The undo button of data structures.
Queue
First in, first out. Fairness, as a data structure.
Deque
A queue open at both ends — a stack and a queue in one structure.
Circular Queue
A queue in a fixed array that never shuffles — the pointers go round instead.
Monotonic Stack
A stack kept in order — so one new value can answer many old questions at once.