Sub topic 10
Case 3: When the Root Dominates, and the Regularity Condition
This chapter assumes you know the statement of the master theorem for T(n) = aT(n/b) + f(n), how to compute the critical exponent log_b a, and how to sum a geometric series. Case 1 covered recurrences where the leaves do most of the work. Case 3 covers the opposite situation, where the top of the recursion tree does most of the work.
The statement
Case 3 applies when both of these conditions hold:
- Growth condition: f(n) = Ω(n^(logb a + ε)) for some constant ε > 0. In words, f(n) grows polynomially faster than n^(logb a).
- Regularity condition: a·f(n/b) ≤ c·f(n) for some constant c < 1 and all sufficiently large n.
When both hold, T(n) = Θ(f(n)).
Why the root wins
At depth j the tree has a^j subproblems of size n/b^j, so the total work at that level is a^j·f(n/b^j). If you apply the regularity condition j times, you get a^j·f(n/b^j) ≤ c^j·f(n). The per-level work therefore shrinks at least geometrically:
Summing all levels gives at most f(n)·(1 + c + c² + ...) = f(n)/(1 − c), which is O(f(n)). The root alone contributes f(n), so the total is also Ω(f(n)). Together these give Θ(f(n)).
Worked examples
T(n) = 2T(n/2) + n². Here a = 2, b = 2, and log_2 2 = 1. Since n² = Ω(n^(1+ε)) with ε = 1, the growth condition holds. For regularity, 2·(n/2)² = n²/2, so c = 1/2 works. The answer is T(n) = Θ(n²).
T(n) = 3T(n/4) + n log n. Here log_4 3 ≈ 0.793, and n log n = Ω(n^(0.793+ε)) with ε ≈ 0.2. For regularity, 3·(n/4)·log(n/4) ≤ (3/4)·n log n, so c = 3/4 works. The answer is T(n) = Θ(n log n).
When regularity is automatic, and when it is not
If f(n) = n^d, then a·f(n/b) = (a/b^d)·n^d. The ratio a/b^d is below 1 exactly when d > log_b a. That means the growth condition already implies regularity for polynomials, and the same holds for polynomials times powers of log n. The condition matters for functions that oscillate. Take T(n) = T(n/2) + n(2 − cos n). The growth condition holds, because f(n) ≥ n. But whenever cos(n/2) ≈ −1 and cos n ≈ 1, the ratio f(n/2)/f(n) comes close to (3n/2)/n = 1.5, so no constant c < 1 works.
The script below estimates the worst ratio a·f(n/b)/f(n) over a range of n:
import math
def max_ratio(a, b, f, lo=1000, hi=200000, step=1):
return max(a * f(n / b) / f(n) for n in range(lo, hi, step))
print(round(max_ratio(2, 2, lambda n: n**2), 4)) # 0.5
print(round(max_ratio(3, 4, lambda n: n * math.log2(n)), 4)) # just under 0.75
print(round(max_ratio(1, 2, lambda n: n * (2 - math.cos(n))), 4)) # close to 1.5A ratio that stays at or above 1 for large n means case 3 cannot be used.
Exercise
Solve T(n) = 4T(n/2) + n³ with the master theorem. Give ε and a valid c.
Show answer
log_2 4 = 2, and n³ = Ω(n^(2+ε)) with ε = 1. Regularity: 4·(n/2)³ = n³/2, so c = 1/2. Case 3 gives T(n) = Θ(n³).
Exercise
Does case 3 apply to T(n) = 2T(n/2) + n log n? Explain.
Show answer
No. log_2 2 = 1, and n log n is not Ω(n^(1+ε)) for any ε > 0, because log n grows more slowly than every positive power of n. This recurrence falls under extended case 2 and solves to Θ(n log² n).