Recursion trees

Refer Erickson (2019, p. 32)

Consider the recurrence

where , , and is asymptotically positive. is the sum of all values in the recursion tree; evaluating this sum level by level, we obtain

E1

where is the depth of the tree. If we take to be our base case, we have . This means that we have leaves in the recursion tree, and the last term in (E1) is .

Three common cases:

  1. If the series decays exponentially - every term is a constant factor smaller than the previous term - then it follows from the properties of geometric series that . In this case, the sum is dominated by the value at the root of the tree.
  2. If all terms in the series are equal, we have .
  3. If the series grows exponentially - every term is a constant factor larger than the previous term - then . In this case, the sum is dominated by the number of leaves in the recursion tree.

Understanding cases 1, 2, and 3 by varying and for a fixed is easy, as seen in ^ddb755. How does varying affect ? Roughly speaking, if grows faster, we gravitate toward case 1, and vice versa. For example, consider the merge sort recurrence again. For , we were in case 2. What happens if we have instead?

so we’re now in case 1, and . What about ?

we’re in case 3, and .

We can make this more precise. Let be the critical exponent. Then,

  1. If for some , and if for some and all large , then .
  2. If for some , then .
  3. If for some , then .

[!Reminder] Ask Vardhan for a proof of this


References

Erickson, J. (2019). Algorithms (1st paperback edition). Selbstverlag.