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.
Table of Contents
Start Your Interview Preparations!
Already have an account? Log in!