Consider a recurrence relation of the following structure.

This equation and its coefficients tells us a lot about the algorithm. Each letter represents a part of how the algorithm works.

  • tells us the number of subproblems we divide into.
  • is the size of each of the subproblems. We can have multiple terms in a single relation.
  • is the time it takes to recombine and/or divide the the subproblems. , and so we can say for some constant and .

Finally, would then tell us the overall running time for a size .

Intuition and results

The master theorem tells us about the balance between the number of subproblems (and the size of each), and the time it takes to recombine. They both fight for runtime.

  1. . In this case, the cost to recombine the subproblems is cheaper than the number of subproblems. Then, .
  2. . Here, the cost to recombine is expensive, and will dominate. Therefore, we have .
  3. . Here, the cost of recombining and the size of the subproblems have the “same weight” and one does not dominate the other. Therefore, we can’t ignore either and .


Draw a tree. At level , we have one node of size . At level 1, we have nodes of size . At level 2, we have nodes of , and so on.

The height of this tree satisfies the equation . Solving this we have . We get the total cost by summing the cost of each level, for each node:

Once again, we can consider the three cases: , , and . The other important part to realize is that the summation we have (after pulling out ) is a geometric series. This tells us how the summation will evaluate, and which term in the summation will dominate the others.