📝 Substitution Method
Like a whiteboard proof: Guess, then verify with induction
How Substitution Method Works
- Guess the form of the solution (e.g., O(n log n))
- Assume it holds for smaller values (Inductive Hypothesis)
- Substitute into the recurrence
- Prove it holds for n (find constants that work)
📌 Problem: Solve this recurrence
T(n) = 2T(n/2) + n
Our guess:
T(n) = O(n log n)
âś…
Proof Complete! We have shown T(n) = O(n log n)