Explain like I'm five · Systems

What is Time Complexity (Big-O)?

Time complexity and Big-O notation, told as a story about a ruler that measures how fast work grows as the garage scales up.

10 cars: done in no timethe garage grew from 10 cars to 10,000but for some tasks, time grows far faster than the number of cars

What was fine at 10 cars never finishes at 10,000.For some tasks, time grows far faster than the number of cars.

10x the cars means 10x the time, right…how fast the time grows depends entirely on the working method

'More cars means proportionally more time' isn't true for every method.How fast the time grows depends entirely on the working method.

AS n (CARS) GROWS, THE WORK…O(1): always the sameO(log n): grows very slowlyO(n): grows with nO(n²): grows much steeperBig-O = a ruler for how fast the work grows as the cars pile upBig-O measures the shape of the growth, not one fixed number of seconds

Big-O = a ruler for how fast the work grows as cars pile up.Big-O measures the shape of the growth, not one fixed number of seconds.

O(1)find it by plate number — same time however many cars
O(log n)halve the candidates each time, like a binary tree
O(n)check them one by one, down the line
O(n²)compare every car against every other
n=10 vs n=1,000, HOW MANY STEPS?O(1): 1 step → 1 stepO(log n): 3 steps → 10 stepsO(n): 10 steps → 1,000 stepsO(n²): 100 steps → 1,000,000 stepsO(n²) step counts balloon out of handthe bigger n gets, the wider the step counts pull apart by growth shape

The gap in step counts between methods explodes as n grows.O(n²) step counts balloon out of hand.

BY PLATE NUMBERO(1)the actual seconds depend on the gear and situationONE BY ONE IN A LINEO(n)but the shape of the growth is always comparableBig-O is a ruler for the trend — not a stopwatch

Big-O measures only the shape of the growth, not actual seconds.The actual seconds depend on the gear and situation.

In one breath

Big-O (time complexity) = a ruler that measures the shape of how fast the work grows as the number of cars (the data) increases.

Time complexity measures how fast an algorithm's running time grows as the input size n increases. O(1) stays constant regardless of input size; O(log n) halves the remaining work each step, as in binary search; O(n) scans everything once; O(n²) compares every pair, growing steeply as n increases. Big-O ignores constant factors and actual hardware speed — it compares only the growth trend.

When grown-ups say it

O(1)
Found directly by plate number — always the same time. Time stays flat no matter how much input grows.
O(log n)
A search that halves the candidates each step. Time grows very, very slowly as the input grows.
O(n)
Checking one by one, down the line. Time grows in proportion to the input size.
O(n²)
Comparing every car against every other. Time steepens out of hand as n grows.
Binary Tree Search (an O(log n) example)
A shelf map that halves the search at every fork. See what O(log n) actually looks like. → the shelf map that halves the search at every fork
Stack/Queue push-pop (an O(1) example)
The rule for stacking boxes or lining up cars. push/pop and enqueue/dequeue are usually O(1). → boxes get stacked, cars get queued
Cache Hit/Miss
A hit: the tool is in the toolbox. A miss: it isn't. Even at the same O(1), a hit and a miss feel very different in practice. → the toolbox kept right beside you
CPU Scheduling
The rule deciding who gets the lift first. Sorting or searching the job board is measured with this same ruler. → who gets the lift first
Next story
Different Ways to Line Cars Up by Size →
Want another term as a picture book? Request →