Recursion Tree Method
Analyzing Recurrence Relations
Visually
What is a Recursion Tree
• Definition: A recursion tree is a visual
representation of how a recursive function
breaks a problem down into subproblems.
– Each node in the tree represents a recursive
subproblem.
– The children of a node represent the further
subproblems that arise when you solve that node.
– The cost at each node shows the amount of work
done outside the recursive calls
Why Use Recursion Trees?
• Visualize the breakdown of a problem.
• Understand how much work is done at each
level.
• Sum up the total work to find the overall time
complexity.
Example Recurrence
• Example: Merge Sort
T(n) = 2T(n/2) + O(n)
• Problem splits into 2 subproblems.
• O(n) cost for splitting & merging.
When to Use Recursion Tree
• You have a divide-and-conquer algoritham
• recurrence, like T(n) = aT(n/b) + f(n).
• You want to visualize the work breakdown.
Example Practice
Try drawing recursion trees for:
• T(n) = T(n/2) + O(1)
(Binary Search → O(log n))
• T(n) = 3T(n/4) + O(n)
(Strassen’s Algorithm style)
• T(n) = 2T(n/2) + O(n^2)
(Naive matrix multiplication)