Visual walkthrough — Divide and conquer — template, correctness, recurrence
We build everything from zero. If you have never seen a recursion tree, a logarithm, or the symbol , start at Step 1 anyway — each is earned before use.
Step 1 — What a recurrence actually says
WHAT. We start with one line, the promise of the divide-and-conquer template:
Read it in plain words: the cost of a size- job equals copies of the cost of a size- job, plus — the divide+combine work you do yourself before/after the recursive calls.
- = the number of basic steps a size- problem takes. is a function: feed it a size, it returns a time.
- = how many subproblems each call spawns (mergesort: 2, binary search: 1, Karatsuba: 3).
- = the shrink factor — inputs of size become size .
- = the work you do without recursing: splitting the array, merging the results.
WHY a recurrence at all? Because is defined in terms of itself. We cannot read off an answer; we must unfold the self-reference until it stops. That unfolding is a tree.
PICTURE. One box calling smaller boxes, each labelled with its size and its local work.

Step 2 — Unfold one level: the tree grows
WHAT. Replace each by its own definition. The recurrence applied at size says Substitute this into and multiply the through the bracket:
Term by term on level 1:
- there are children ⟶ factor ,
- each does local work (its size is ),
- so the whole of level 1 costs ;
- and subproblems of size are still waiting (level 2).
WHY unfold? The self-reference is still sitting there (). We keep expanding until hits a size we can answer for free (the base case). Each expansion peels off one honest, recursion-free level of work — and those we can add up.
PICTURE. Two full levels now drawn; the level-1 boxes lit up with their total.

Step 3 — The pattern at depth
WHAT. Keep going. At depth (the root is depth ): So the total work on level is:
Reading the box:
- — each level multiplies the node count by again, so after levels there are nodes.
- — each level divides the size by again, so after levels each node holds .
- — plug that size into the local-work function.
WHY these two racing quantities? Node count grows up, size shrinks down. The entire theory of divide-and-conquer running time is a tug-of-war between these two. Whoever wins decides the answer.
PICTURE. Three levels stacked, with the / / pattern annotated on a generic level .

Step 4 — Where the tree stops: counting the levels
WHAT. Recursion halts when a node's size hits (the base case). Set:
- — we divided by a total of times and reached size , so multiplied times must rebuild .
- — this is the definition of a logarithm: "how many times do I multiply to reach ?" That count is the height of the tree.
WHY count levels? Total cost = sum over all levels. To sum, we need to know how many levels there are — and the last (leaf) level is special, so we mark it.
PICTURE. The full tree from root to leaves, height labelled , the bottom row of leaves highlighted.

Step 5 — The leaves: counting the bottom row
WHAT. The bottom level is . Number of leaves:
Each leaf is a base case costing , so the whole leaf row costs .
Why does ? This is a log identity, not a trick:
- we rewrote (that is just the definition of ),
- multiplied exponents,
- regrouped to expose .
WHY name this exponent? Call it . It is the cost the leaves alone contribute. It becomes our yardstick: we compare the per-level work against to see who wins the tug-of-war.
PICTURE. Zoom on the leaf row: leaves, each a small box.

Step 6 — Add every level: the master sum
WHAT. Total time = leaves + sum of all internal levels:
- — the leaf row (Step 5),
- — add up every internal level from the root () to just above the leaves,
- — the level- cost from Step 3.
WHY a sum, and why does it collapse? The sum's terms usually form a geometric series — each term is a fixed ratio times the previous. To make a genuine constant, we need mild conditions on :
With constant, geometric series are dominated by ONE end:
- (terms shrink downward) ⟶ the root dominates ⟶ .
- (all terms equal) ⟶ every level costs the same, of them ⟶ .
- (terms grow downward) ⟶ the leaves dominate ⟶ .
Those three outcomes are exactly the three cases of the Master Theorem — but now you see why three cases exist: a geometric series has only three moods.
PICTURE. A bar per level (bar height = that level's cost) for the three moods: shrinking bars, flat bars, growing bars.

Step 7 — Four real algorithms, seen side by side
WHAT. Plug in landmark recurrences and read the bars. One representative per mood.
WHY these four? Flat (), the degenerate chain, root-heavy (), and leaf-heavy () — the picture now covers every mood the bars can take.
PICTURE. Four mini-trees with their bar-profiles: mergesort (flat), binary search (thin chain), root-dominated (top-heavy, shrinking), Karatsuba (bottom-heavy, growing).

Step 8 — Degenerate & edge cases the picture must cover
WHAT. Never leave a scenario undrawn. Four corners:
- (binary search): the "tree" is a single vertical chain — no branching. Only the height matters. Not a bug; the sum still works, it just has one node per level.
- (size never shrinks): then forever — infinite recursion. The tree has no bottom. This is the no-progress failure; the recurrence has no solution because the algorithm never terminates. (Matches the parent's base-case warning.)
- at the top: we are already a leaf. , zero recursive calls. The sum from Step 6 is empty; the boxed formula still returns . ✓
- Master-Theorem gap — : here is not a clean power, so the ratio drifts with the level instead of staying constant — sits a log-factor above . Not clean geometric ⟶ Master Theorem gives no case. The tree still works: each of the levels costs , summing to . Use the tree, or Recurrence Relations / Akra–Bazzi.
WHY show these? Cases 1–3 are where a naive reader thinks the machinery "breaks"; it does not — the tree formula absorbs them. Case 4 is where the shortcut breaks but the tree survives — proof that the picture is the fundamental object, the Master Theorem merely its clean corollary.
PICTURE. Four small panels: chain (), bottomless tree (), single leaf (), and the near-miss with its slightly-rising bars.

The one-picture summary
Everything on one canvas: the tree with nodes and sizes per level, the height , the leaves, the per-level bar profile, and the three verdicts (root / flat / leaves win) branching off the ratio .

Recall Feynman retelling — say it back in plain words
A big job splits into smaller jobs of size , and you pay yourself to split and glue. Draw that as a tree. Going down one level multiplies the number of jobs by and divides each job's size by . So level has jobs of size , doing total work. The tree ends when size hits , which takes levels — that's just "how many halvings to reach one." The bottom row has leaves, kept as a separate term because leaves do only free base-case work — which is why the -sum stops one row short, at . Now stack the work of every level as bars. Provided is a nice power like , each level is a fixed multiple of the one above, so the bars either shrink (root wins → ), stay flat (all equal → ), or grow (leaves win → ). Those three bar-shapes ARE the three Master-Theorem cases. shrinks → ; mergesort's bars are flat → ; Karatsuba's grow → . And when isn't a clean power (like ), drifts, the shortcut shrugs, but the tree still hands you . The tree is the truth; the theorem is just its tidy summary.