Recurrence Relations - Applications
The Master Theorem is a powerful tool for analyzing divide-and-conquer algorithms, providing asymptotic solutions to a broad class of recurrence relations without requiring detailed calculation.
Let and be constants, and let be a function. Consider the recurrence:
where we interpret as either or . Then:
Case 1: If where , then .
Case 2: If where and , then .
Case 3: If where , and if for some constant and sufficiently large (regularity condition), then .
Intuition:
The recurrence describes an algorithm that:
- Divides a problem of size into subproblems of size
- Performs work to divide and combine
The recursion tree has height (depth of recursion) and nodes at level , each with work .
Total work:
The three cases compare with (the number of leaves):
- Case 1: Leaf-dominated: most work is in base cases
- Case 2: Balanced: work is evenly distributed across levels
- Case 3: Root-dominated: most work is in dividing/combining
Proof Sketch (Case 1):
Assume where . Let .
At level of the recursion tree, there are nodes, each doing work.
Total work at level :
Since , we have , so work increases geometrically with depth.
Summing over all levels:
The geometric series is dominated by its last term, which is .
Therefore, .
Merge Sort:
- Here , , , so
- Case 2 with :
Binary Search:
- Here , , , so
- Case 2 with :
Strassen's Matrix Multiplication:
- Here , , , so
- Case 1 since :
The Master Theorem doesn't cover all recurrences. For instance, falls in the gap between Cases 2 and 3. The Akra-Bazzi method generalizes to handle variable partition sizes and more complex combining costs. For recurrences with multiple recursive calls of different sizes (like ), more sophisticated analysis or the Akra-Bazzi method is required.