๐ WAYPOINT LESSON
Growth, not stopwatches
โญ beginnerโณ 13 min read๐ Lesson 78 of 85
Big-O describes how work grows with input size โ counting operations beats timing a machine.
Counting, not timing
A stopwatch measures a machine; growth describes an algorithm. Count how the work grows as input size n grows:
| Shape | Example | n = 10 | n = 10,000 | | --- | --- | --- | --- | | O(1) | dictionary lookup | 1 | 1 | | O(log n) | binary search | ~3 | ~14 | | O(n) | one loop | 10 | 10,000 | | O(nยฒ) | nested loops | 100 | 100,000,000 |
Nested loops multiply: an outer loop over n with an inner loop over n is n ร n. That last row is why "it works on my test data" is not a performance argument โ a fix that turns 100,000,000 steps into 10,000 is the difference between a feature and a freeze.