Before you can trust the formula, you must be able to point at a picture for every letter in T(n)=aT(n/b)+f(n). This page builds each one from nothing, in the order they depend on each other.
Picture a row of n boxes. If you have 8 numbers to sort, n=8. Everything in this topic asks: as n grows huge, how does the running time grow? We never care about small n; we care about the trend.
To read the tree we need bi ("b multiplied by itself i times").
Why do we need it? Because at level i of the recursion tree, each subproblem has size bin and there are ai of them. Powers are simply the bookkeeping for "how deep are we, and how many boxes are there."
Here is the tool that scares people. We introduce it because we must answer one specific question: how many times can I divide n by b before I hit size 1?
The stopping condition of the tree: size bLn=1⇒bL=n⇒L=logbn. That L is the height — the number of floors in the building.
Recall Why is the tree's height only
logbn and not n? (click)
Because we divide each step, not subtract. Dividing 1,000,000 by 2 reaches 1 in ~20 steps, not a million. Shrinking is exponentially fast → the height is a logarithm. :::
Plain-words proof of the swap: write a=blogba, so
alogbn=(blogba)logbn=blogba⋅logbn=(blogbn)logba=nlogba.
We just reshuffled the exponents (multiplication of exponents commutes) and used blogbn=n.
Picture: the bottom row of the tree has nlogba tiny boxes. That is the "pile of chores at the bottom." The entire Master Theorem is one comparison — race f(n) against nlogba.
a big (many branches) → more leaves → ccrit big → leaf pile heavy.
b big (fast shrink) → shorter tree → fewer leaves → ccrit smaller.
The three cases say "f is smaller", "equal", "bigger". Those words need a precise meaning that ignores constants and only cares about the growth trend.
See Geometric Series. When we add up the work across all levels of the tree, level-i cost divided by level-(i−1) cost is a constant ratio r. Those three behaviours of r are exactly Case 1, Case 2, Case 3 — leaves win, tie (multiply by height), root wins. The three cases are not arbitrary; they are the three moods of a geometric series.