Intuition The ONE core idea
A recursive algorithm does its total work by spawning smaller copies of itself, and the whole runtime is just the sum of the tiny bits of work done at every single call . The recursion tree draws all those calls as a family tree of jobs so you can see and add up the work — row by row — instead of guessing.
Before you can read the parent note , you need to own every letter it throws at you. This page builds each one from nothing: plain words → a picture → why the topic can't live without it . Read top to bottom; each item leans on the one above.
n = how big the input is
n is simply a count of how many things your algorithm must handle. Sorting n numbers, searching a list of n items, etc. It is a whole number that grows without limit as the input grows.
Think of n as the length of a row of boxes you must process. When we say "cost n ", we mean "doing something once to each of the n boxes".
Why the topic needs it: every recursion tree question is "how does the work scale as n → ∞ ?" Without a name for input size, there is nothing to scale.
f ( n )
f is a rule that takes a size and returns a cost . Feed it a problem of size m , and f ( m ) tells you how much non-recursive work that one call does — the work it does itself , ignoring the work it hands to smaller calls.
f is a meter you clip onto one call . It reads only the effort spent inside that call — the splitting and combining — not the effort of its children.
Common meters you'll meet:
f ( n ) = n → work grows in a straight line (do one thing per box).
f ( n ) = n 2 → work grows like the area of an n × n square.
f ( n ) = 1 → constant work, ignores size.
Why the topic needs it: the value written inside every tree node is f ( size of that node ) . f is what you sum.
T ( n ) = total work for size n
T ( n ) is the grand total of all work an algorithm does on an input of size n , including every recursive call. This is the quantity we actually want.
T vs f — don't confuse them
f ( n ) = work of one call by itself . T ( n ) = work of that call plus everyone it triggers . f is one meter reading; T is the sum of all meter readings in the whole tree.
Why the topic needs it: the entire method exists to compute T ( n ) . Everything else is bookkeeping toward this number.
Definition Recurrence relation
A recurrence is an equation where T appears on both sides , describing T ( n ) in terms of T of smaller inputs. The star example:
T ( n ) = a T ( n / b ) + f ( n ) .
Read it in plain English: "The work on size n equals the work of a smaller jobs of size n / b , plus f ( n ) for the splitting/combining I do myself."
Intuition Why "self-referential" is the whole problem
You cannot just read off T ( n ) — the right side hides more T 's inside it. To answer, you must unfold the equation: replace each T ( n / b ) by its own recurrence, again and again. The tree is that unfolding drawn out. See Substitution Method for the algebra version of the same unfolding.
Why the topic needs it: a recursion tree is literally the picture of one recurrence being unrolled.
a = number of children per call
a is how many smaller subproblems each call creates. In T ( n ) = a T ( n / b ) + f ( n ) , the a sitting in front of T is that count. It satisfies a ≥ 1 .
a is the fan-out of the family tree: one parent, a children. If a = 2 every job splits into 2; the tree doubles its width each level down.
Why the topic needs it: a controls width — how many nodes sit at each depth, hence how many meters you sum per row.
b = how much smaller each child is
Each child handles a problem of size n / b . So b is the factor the size divides by on the way down. It satisfies b > 1 (children must be genuinely smaller, or recursion never ends).
b is the step size going down . With b = 2 , sizes go n → n /2 → n /4 → … — a halving staircase. With b = 4 , the staircase is steeper, n → n /4 → n /16 .
Why the topic needs it: b controls depth — how fast the size falls to 1 decides how many rows the tree has.
x i = multiply x by itself i times
a i means i times a ⋅ a ⋯ a , with a 0 = 1 by convention.
Two powers do all the heavy lifting:
a i = number of nodes at depth i (each of the a i − 1 nodes above made a more).
b i = total shrink after i levels, so size at depth i is n / b i .
Powers show up because the tree does the same multiplication at every level : × a for width, ÷ b for size. Repeating one multiplication i times is raising to the i -th power.
We also write f ( n ) = n d (e.g. d = 1 for n , d = 2 for n 2 ). The exponent d is the "degree" of the per-call work.
Why the topic needs it: the whole verdict hinges on comparing the growth a i against the shrink b d i inside the meter.
log b n = "how many times do I divide n by b to reach 1 ?"
The ==logarithm base b == answers exactly the question the depth needs. Formally, log b n = i means b i = n . It undoes the power: logs and exponents are opposite operations.
Intuition Why THIS tool and not another
We need the depth i where the size n / b i hits 1 . Setting n / b i = 1 gives b i = n . The only thing that pulls i out of an exponent is the logarithm — that's its entire job. So depth = log b n is forced , not chosen.
log b n is the number of steps down the shrinking staircase until each box is a single box. Steeper staircase (bigger b ) → fewer steps → smaller log.
Two facts you'll reuse:
log b n grows very slowly — doubling n adds only a constant to it.
All bases differ by a constant: log 3 n and log 3/2 n are the same up to a fixed multiplier, which is why unbalanced trees still land at Θ ( n log n ) .
Why the topic needs it: depth = log b n is one of the three knobs (DWW). See Binary Search for the simplest place a log appears in code.
Definition Number of leaves
The bottom row has a depth = a l o g b n nodes. A log identity rewrites this as n l o g b a — the count of leaves , each doing Θ ( 1 ) work.
The leaves are the tiniest jobs at the very bottom . There are usually a huge number of them. When they outnumber everything, their combined Θ ( 1 ) costs dominate — the "riot of leaves".
Why the topic needs it: one of the three outcomes is "leaves win", and its size is exactly n l o g b a .
Definition Geometric series
A geometric series adds terms where each is a fixed ratio r times the last: c ( 1 + r + r 2 + ⋯ ) . The level costs of a tree form exactly this shape, with r = a / b d .
Intuition Why this decides the answer
Per-level work = n d ( a / b d ) i . That ratio r = a / b d tells you:
r < 1 : costs shrink downward → root wins → Θ ( f ( n )) .
r = 1 : costs equal → multiply by log b n levels → extra log factor.
r > 1 : costs grow downward → leaves win → Θ ( n l o g b a ) .
This is the Master-Theorem verdict, derived from one series. See Geometric Series and Master Theorem .
Why the topic needs it: deciding "who dominates" is asking which way the geometric series tips.
Definition Asymptotic notation
These describe growth as n → ∞ , ignoring constants and small terms:
O ( g ) = grows at most like g (upper bound).
Ω ( g ) = grows at least like g (lower bound).
Θ ( g ) = grows exactly like g (both bounds).
Imagine two curves. O says "my curve stays under a stretched copy of g ". Θ says "it's sandwiched between two stretched copies of g ". We use Θ for final answers because we want the true growth rate.
Why the topic needs it: the recursion tree's output is always stated as Θ ( … ) ; constants get dropped because the tree only reveals shape, not exact tallies. Full treatment in Big-O Notation .
level work a to i times f
geometric series ratio a over b to d
Read it as: the four ingredients (n , f , a , b ) assemble the recurrence; the recurrence unfolds into the tree; width and depth come from a and b ; the level-work forms a geometric series; the series verdict, expressed in Big-O, is the answer.
Self-test: can you answer each without peeking?
What does n mean and what picture goes with it? Input size — a row of n boxes to process.
What is the difference between f ( n ) and T ( n ) ? f ( n ) is the work of one call by itself; T ( n ) is the total of that call plus all recursive calls it triggers.
In T ( n ) = a T ( n / b ) + f ( n ) , what do a and b each control? a controls width (children per node); b controls depth (how fast size shrinks).
Why is the tree depth log b n and not something else? Because size at level i is n / b i ; setting it to 1 gives b i = n , and only a log pulls i out of the exponent.
How many nodes and how many leaves does the tree have at depth i and at the bottom? a i nodes at depth i ; a l o g b n = n l o g b a leaves at the bottom.
What is the ratio of a recursion tree's geometric series, and what do r < 1 , r = 1 , r > 1 mean? r = a / b d ; r < 1 root dominates, r = 1 equal levels (extra log ), r > 1 leaves dominate.
Why do we state the final answer with Θ instead of exact numbers? The tree reveals growth shape, not exact constants, so Θ captures the true growth rate while ignoring constant factors.