All posts
Cheat Code

Big-O explained by a chai-stall queue

One person orders and you serve them: constant time. A queue of n people served one by one: linear. Everyone in the queue comparing orders with everyone else: quadratic. Big-O only asks how the work grows as the line grows. Next time you choose a solution, ask yourself: if the queue gets ten times longer, what happens?