Skip to content
Programming

Stacks and Queues

Account required to view full content

Stacks and queues are the two simplest containers in the interview canon, and that simplicity is exactly why they get asked. A stack is last in, first out; a queue is first in, first out. Get those two orderings straight and a whole family of problems falls out: balanced-parentheses checks, the call stack itself, breadth-first search, and the fixed-size ring buffers that trading systems use to hold the most recent ticks. This lesson covers both structures, shows the right and wrong way to build each in Python (and the real cost difference), and works our interview question Circular Queue Implementation from scratch with the full test sequence.