The three cases are which level dominates
Work per level either grows, shrinks or stays constant down the recursion tree, and log_b a against d is exactly that comparison.
Divide-and-conquer produces recurrences of one shape, T(n) = aT(n/b) + f(n), solved by the master theorem. The technique's power comes from reducing a, not from combining faster.
Core ideas
“Divide-and-Conquer Recurrences” in Induction and Recursion solved these recurrences; this lesson uses them to compare algorithm designs.
Work per level either grows, shrinks or stays constant down the recursion tree, and log_b a against d is exactly that comparison.
Karatsuba's improvement is three multiplications instead of four, and log₂3 < log₂4. Faster combining cannot do that.
Quicksort's split depends on the pivot, so it has no fixed b — and its worst case is quadratic while its average is n log n.
The material
The pattern, the master theorem, and four algorithms compared.
A divide-and-conquer algorithm splits an input of size n into a subproblems of size n/b, solves each recursively, and spends f(n) dividing and combining. The running time therefore satisfies T(n) = aT(n/b) + f(n).
For T(n) = aT(n/b) + Θ(nᵈ) with a ≥ 1, b > 1, d ≥ 0: T(n) = Θ(nᵈ) if log_b a < d; Θ(nᵈ log n) if log_b a = d; and Θ(n^{log_b a}) if log_b a > d.
The three cases are the recursion tree's shape. Level i holds aⁱ subproblems of size n/bⁱ, doing nᵈ(a/bᵈ)ⁱ work in total — a geometric series whose ratio a/bᵈ is below, equal to, or above 1 exactly as log_b a is below, equal to, or above d.
Karatsuba multiplies two n-digit numbers by splitting each in half. The obvious method needs four half-size products, giving T(n) = 4T(n/2) + n = Θ(n²) — no better than schoolbook multiplication. Karatsuba's identity computes the same result with three products, and log₂ 3 ≈ 1.585 < 2.
Strassen does the same for matrices: seven products of half-size blocks instead of eight, giving Θ(n^{2.807}). In both cases the gain came from reducing a, and no amount of faster combining could have produced it — d only matters when it exceeds log_b a.
Quicksort partitions around a pivot, and the split depends on the data. A perfect pivot gives T(n) = 2T(n/2) + n = Θ(n log n); the worst pivot gives T(n) = T(n−1) + n = Θ(n²). The master theorem does not apply to the second, which has no fixed b at all.
Remarkably, even a badly unbalanced but constant split is fine: T(n) = T(n/10) + T(9n/10) + n is still Θ(n log n), because the recursion tree still has logarithmic depth. Quicksort survives imperfect pivots for exactly this reason, and fails only on consistently extreme ones.
Interactive
Counts from running, not from quoting
Method
Read off a, b, d; compare.
How many subproblems, not how much smaller they are.
Halving gives b = 2. If the factor varies with the data, the theorem does not apply.
Merging costs Θ(n) so d = 1; a constant combine gives d = 0.
Less, equal or greater. That single comparison gives the answer, and the recursion tree explains why.
Start from T(n) = 4T(n/2) + n, which is Θ(n²).
This is the structural reason Karatsuba and Strassen both take the form they do. In the leaf-dominated case the combining work is irrelevant, so the only route to a better exponent is fewer subproblems — and finding an identity that removes one is the hard creative step.
For T(n) = 9T(n/3) + n², identify the case and say whether faster combining or fewer subproblems would help. log₃9 = 2 = d, the balanced case, where both would.
Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.
No recommendations yet for this lesson.