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.

110^210^410^610^810^1010^12n (input size)
O(1)O(log n)O(n)O(n log n)O(n²)O(2ⁿ)
GrowthTypical exampleOperations at n = 16At 1 billion ops/sec
O(1) (constant)array lookup by index11 ns
O(log n) (logarithmic)binary search44 ns
O(n) (linear)scanning a list1616 ns
O(n log n) (linearithmic)merge sort6464 ns
O(n²) (quadratic)comparing every pair256256 ns
O(2ⁿ) (exponential)trying every subset65,53665.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

More explainers: Learn hub · Printable cheat sheets · Learning paths