Asymptotic notation: Θ, O, Ω (and o, ω)
◈ 4 cardsThe formal (c, n₀) definitions, Θ ⇔ O ∧ Ω, proving a bound from the definition, the growth hierarchy, and the traps the exam loves.
Why we compare growth rates
We judge algorithms by how their cost grows as , dropping constant factors and lower-order terms. For large those details are dominated by the leading term, so the order of growth is what actually distinguishes algorithms — and it is machine-independent.
The three bounds, formally
Each notation is a set of functions, defined by exhibiting constants. To prove membership you only need to find one valid pair (or triple) of constants.
- — asymptotic upper bound ("no faster than"). iff there exist constants with for all .
- — asymptotic lower bound ("at least as fast as"). iff there exist with for all .
- — asymptotically tight bound ("exactly this rate"). iff there exist with for all .
The single most useful fact (Theorem 3.1) glues them together:
So to prove a tight bound, prove the upper bound and the lower bound separately and cite the theorem — far easier than juggling and at once.
Worked example — prove from the definition
Upper (). Want . Divide by : . At the left side is at most , so works. Hence .
Lower (). Want . Since , , so and any works. Hence .
Both bounds hold, so by Theorem 3.1, — with , , .
The general technique: to disprove an bound (e.g. ), assume it holds, divide by the target, and show the required would have to grow with — impossible for a fixed constant.
Strict bounds: o and ω
Little-oh and little-omega are the strict versions, where the bound holds for every :
- means grows strictly slower than , i.e. (e.g. ).
- means grows strictly faster, i.e. .
The number-line analogy: , , , , . But beware: trichotomy fails — two functions can be incomparable (neither nor of each other), unlike real numbers.
The growth hierarchy you must know cold
The two master rules behind it: any polylog is beaten by any positive polynomial (), and any polynomial is beaten by any exponential ( for $a > 1$). And — the seed of the comparison-sort lower bound.