Chapter 5: Recurrences
Source files used: Convex_hull (Lecture 2 notes, D&C paradigm and recurrences), Vanemdeboas (Lecture 4 notes, square-root recurrences), Matrix Multiplication (Recitation 1, Sections 3.3 and 3.4), MIT6_046JS15_pset1 (Exercise 1-2 as practice); textbook Chapter 4 (chap4, Sections 4.3, 4.4, 4.7 and Problem 4-3) as support. No worked examples are included.
1. Big Picture
A recurrence describes a running time in terms of the running time on smaller inputs. Every divide-and-conquer analysis in the course ends with one.
The Master Theorem guide covered the easy shape . This guide covers everything else: setting a recurrence up, unequal splits, square-root arguments, and the general methods.
The textbook’s four methods:
- substitution (guess, then prove by induction),
- recursion tree (sum the cost level by level),
- master method (cookbook for equal splits),
- Akra-Bazzi (general unequal splits, uses calculus).
The lectures add one more tool: change of variables for .
2. Core Ideas
2.1 Recursive Case and Base Case
A recurrence has a recursive case (calls itself on smaller inputs) and a base case (does not). In algorithm analysis the base case is
for some constant . The textbook’s convention: when no base case is stated, assume this one. The asymptotic answer does not depend on which large enough you pick.
2.2 Setting Up a D&C Recurrence
Lecture paradigm: divide a problem of size into subproblems of size (, ), solve each recursively, combine:
Count the recursive calls (that is ), the size of each call (that is ), and everything else (that is ).
2.3 Floors, Ceilings, and Inequalities
Floors and ceilings almost never change the asymptotic answer, so drop them. A recurrence written with gives only an bound; with , only an bound.
2.4 Bushiness Matters
The number of children per node in the recursion tree controls the leaf count. The textbook contrast: is , while is , even though the second has a smaller . Eight children give far more leaves.
2.5 Recursion Trees Generate Guesses
The textbook’s advice: use a recursion tree to guess, then verify the guess with substitution. You can be a little sloppy while guessing; the substitution proof must be exact. The substitution method itself is covered in the Induction guide.
3. Main Governing Equations and Formulas
3.1 Recursion Tree Sum for
Depth has nodes, each costing . The tree has height and leaves.
Use to see which levels dominate (root, all equal, or leaves).
3.2 Geometric Levels: Textbook Example
For , the cost at depth is
A decreasing geometric series, so the root dominates:
Use whenever per-level costs shrink by a constant ratio.
3.3 Unequal Splits: Textbook Example
Each full level costs at most . The longest path follows the branch, so the height is . The number of leaves is only . Result:
Use when subproblem sizes add up to exactly .
3.4 Median-Finding Recurrence
The sizes add up to about , so the level costs shrink geometrically and . The master theorem does not apply. Prove it by substitution (Medians and Induction guides).
3.5 Change of Variables
For arguments like , set
Then , and the recurrence becomes a master recurrence in . Solve for and substitute back .
Lecture 4 examples (van Emde Boas):
Textbook Problem 4-3:
Use whenever the argument shrinks by a root instead of a constant factor.
3.6 Where Comes From
The lectures give two views:
- binary search over items costs ,
- , which is the same as .
Halving the number of bits each step reaches 1 bit after steps.
3.7 Akra-Bazzi Method (Textbook)
For , find the unique real with
Then
Textbook example: gives , and since the integral gives .
Use for unequal splits when a recursion tree is too messy. You often only need to know whether , , or .
3.8 Linear Driving Function, Unequal Splits
For and subproblem fractions (so the calls are ):
This is the Akra-Bazzi result with and . Median finding is the first case; is the second.
3.9 Subtract-by-One Recurrences (Textbook)
Unroll the sum; the master theorem does not apply.
4. Problem-Solving Workflow
- Write the recurrence from the algorithm: number of calls, size of each call, non-recursive work (Section 2.2).
- Drop floors, ceilings, and small additive terms like inside for the guess.
- Identify the shape:
- → master theorem,
- argument → change of variables (Section 3.5),
- unequal fractions → recursion tree or Akra-Bazzi (Sections 3.3, 3.7, 3.8),
- → unroll (Section 3.9).
- If no shortcut fits, draw the recursion tree and sum the levels to get a guess (Section 3.1).
- Prove the guess with substitution, using explicit constants (Induction guide).
- State the final bound with , or with / if only one direction was shown.
Practice: Problem Set 1, Exercise 1-2 (g) to (j). Answers to check are in Section 6.2.
5. Decision Rules / Decision Trees
5.1 Which Method?
Equal-size subproblems, ? → master theorem
Argument is or ? → change variables , then master theorem
Several different fractions, linear ? → sum the fractions: gives , gives
Unequal fractions, nonlinear ? → Akra-Bazzi or recursion tree
Need a rigorous proof? → substitution with explicit constants
5.2 Reading a Recursion Tree
Level costs decrease geometrically? → root dominates,
Level costs about equal? → (cost per level) (number of levels)
Level costs increase geometrically? → leaves dominate,
6. Important Tables / Correlations Needed
6.1 Course Recurrences
| Algorithm | Recurrence | Solution |
|---|---|---|
| Merge sort, convex hull | ||
| Convex hull, naive merge | ||
| Block matrix multiply | ||
| Strassen | ||
| Median of medians select | ||
| vEB, one recursive call | ||
| vEB Insert, two calls | ||
| vEB Successor, three calls | ||
| Binary search | ||
| Randomized select, worst case |
6.2 Problem Set 1, Exercise 1-2 (g) to (j): Answer Check
| Recurrence | Method | Answer |
|---|---|---|
| , case 3 | ||
| , case 2 | ||
| , case 2 | ||
| fractions sum to |
7. Key Takeaways
- Unstated base case means for small .
- D&C template: .
- Floors, ceilings, and inside do not change the answer.
- Recursion tree: depth costs ; leaves cost .
- Use recursion trees to guess, substitution to prove.
- arguments: set , .
- ; two calls give ; three give .
- Linear with fractions summing to less than 1 gives ; summing to exactly 1 gives .
- Akra-Bazzi: solve , then integrate .
- ; the master theorem does not apply.