Big-O chart

See why some programs finish instantly while others “hang”: a growth chart of step counts and a table for n = 10, 100 and 1000.

Growth chart

The Y axis is cut at 400 steps so the fast functions stay visible: O(n!) and O(2ⁿ) leave the chart already at a small n.

How many steps

Complexityn = 10n = 100n = 1000Example
O(1)Constant111Reading an array item by index
O(log n)Logarithmic3.36.610.0Binary search in a sorted list
O(n)Linear101001000One pass over a list
O(n log n)Linearithmic33.2664.49965.8Merge sort, quicksort
O(n²)Quadratic10010 0001MTwo nested loops
O(2ⁿ)Exponential1024≈10^30≈10^301Trying every subset
O(n!)Factorial3.6M≈10^157∞Trying every permutation

If a step takes a billionth of a second, O(n²) for n = 1000 is a hundredth of a second, while O(2ⁿ) for n = 100 takes longer than the universe has existed.

More in the Study

Write fast code

The courses teach not only syntax but how to choose the right approach.