The Master Theorem provides a direct formula for solving recurrence relations of the form:
$$T(n) = aT!\left(\frac{n}{b}\right) + O!\left(n^c\right)$$
Where:
- $a \geq 1$: number of recursive sub-calls
- $b > 1$: factor by which input is divided
- $c \geq 0$: exponent in the non-recursive work $f(n) = O(n^c)$
- Base case: $T(1) = O(1)$
KEY TAKEAWAY: The Master Theorem compares the cost of recursive work ($n^{\log_b a}$) against the cost of non-recursive work ($n^c$). Whichever dominates determines the overall complexity.
Let $\log_b a$ be the “critical exponent.” Compare $c$ to $\log_b a$:
| Case | Condition | Solution |
|---|---|---|
| Case 1 | $c < \log_b a$ | $T(n) = O(n^{\log_b a})$ — recursive work dominates |
| Case 2 | $c = \log_b a$ | $T(n) = O(n^c \log n)$ — both contribute equally |
| Case 3 | $c > \log_b a$ | $T(n) = O(n^c)$ — non-recursive work dominates |
$T(n) = 2T(n/2) + O(n)$
$$T(n) = O(n^1 \log n) = O(n \log n)$$
$T(n) = T(n/2) + O(1)$
$$T(n) = O(n^0 \log n) = O(\log n)$$
$T(n) = T(n/2) + O(n)$
$$T(n) = O(n^1) = O(n)$$
$T(n) = 8T(n/2) + O(n^2)$
$$T(n) = O(n^3)$$
The Master Theorem applies only to recurrences of the form $T(n) = aT(n/b) + O(n^c)$.
It does not apply when:
- Sub-calls have different sizes (e.g., $T(n) = T(n/3) + T(2n/3) + O(n)$)
- The non-recursive term is not a polynomial (e.g., $O(n \log n)$)
- $a < 1$ or $b \leq 1$
EXAM TIP: VCAA exams always use the stated form. Identify $a$, $b$, and $c$; compute $\log_b a$; compare with $c$ to determine the case. Show these steps explicitly in your answer.