Growth Ranking
O(1) ⊂ O(log n) ⊂ O(n) ⊂ O(n²) ⊂ O(nᵏ) ⊂ O(kⁿ)
Growth Ranking Lemma (Lemma 0.5):
These classes are nested: every constant function is eventually bounded by
every logarithmic function; every logarithmic by every linear; etc.
Why this matters. When you analyze an algorithm, identifying its growth
class lets you compare it to others without doing exact arithmetic. "Is it
better than ?" is a meaningful question; "is it or
?" usually is not.
Reading the chain:
- : hash table lookup. Independent of .
- : binary search. Each step halves the problem.
- : scan a list once.
- : merge sort, heap sort. Best general-purpose sorting.
- : bubble sort, naive all-pairs.
- : polynomial. Acceptable for small .
- : subset enumeration. Becomes infeasible fast.
Crucial observation. Polynomial vs. exponential is the cliff. Anything
polynomial is "tractable" for reasonable (within hardware limits).
Anything exponential hits a wall around .
Proving : any is bounded by
. We need for large . Take : .
So with . ✓
Each step in the chain has a similar proof using elementary inequalities.
- 0.0sGrowth of Common Functions
- 0.8sAxes drawn: n on the horizontal, f(n) on the vertical.
- 1.8sConstant 1: flat baseline.
- 2.6slog n: barely rises across the entire range.
- 3.4sn: a steady diagonal line.
- 4.2sn squared: curves up gently at first, steepens later.
- 5.0s2 to the n: explodes exponentially and dwarfs every other curve.
- 6.4sExponential eventually overtakes everything.