ChoralSoft Learn
Big-O, drawn
See how running time grows as the input grows, and why some algorithms never scale.
How fast does the work grow?
Drag the slider to change the input size n. The chart uses a logarithmic vertical axis so every curve stays visible; each gridline is ten times higher than the one below.
O(1)O(log n)O(n)O(n log n)O(n²)O(2ⁿ)
| Growth | Typical example | Operations at n = 16 | At 1 billion ops/sec |
|---|---|---|---|
| O(1) (constant) | array lookup by index | 1 | 1 ns |
| O(log n) (logarithmic) | binary search | 4 | 4 ns |
| O(n) (linear) | scanning a list | 16 | 16 ns |
| O(n log n) (linearithmic) | merge sort | 64 | 64 ns |
| O(n²) (quadratic) | comparing every pair | 256 | 256 ns |
| O(2ⁿ) (exponential) | trying every subset | 65,536 | 65.5 µs |
Try n = 40: an O(n²) job is 1,600 operations, but an O(2ⁿ) job is over a trillion. Exponential algorithms stop being usable long before the input gets large.
Go deeper
- Article: Big-O in plain language
- Article: Amortized analysis, why dynamic arrays still append in O(1)
- Free algorithm cheat sheet
- Interactive: Binary search
More explainers: Learn hub · Printable cheat sheets · Learning paths
