Link

Recursive Algorithm Analysis Study Guide

Recurrence Relations. Recurrences help us model the runtime of recursive algorithms by separately analyzing recursive work and non-recursive work.

Solving Recurrences. We can solve recurrences and find closed-form solutions by unrolling the recurrence. Some recurrences are more challenging to unroll than others. Recursion trees can be a helpful visualization tool. By drawing out a tree representing the recursive and non-recursive work, we can identify patterns and use these patterns to help us find a simple, closed-form solution.

Important Summations. In addition to the summations most commonly used for iteration analysis, recursive algorithms can involve geometric series. Know the following infinite geometric series.

  • 1/2 + 1/4 + 1/8 + 1/16 + … which converges to 1.
  1. Give a tight asymptotic bound for each of the following recurrences.
    • T(N) = 2T(N - 1) + 1
    • T(N) = 2T(N / 2) + N
    • T(N) = 2T(N / 2) + 1
    • T(N) = T(N - 1) + N
    • T(N) = T(N - 1) + 1
    • T(N) = T(N / 2) + N
    • T(N) = T(N / 2) + 1
  2. Q4c from CSE 373 19au MT (Solution)
  3. Q3a, Q3b from CSE 373 19au Final (Solution)
  4. Q5 from CS 61B 15sp MT2 (Solution)
  5. Q9 from CS 61B 16sp MT2 (Solution)
  6. Q4b from CS 61B 17sp MT2 (Solution)
  7. Q5 from CS 61BL 17su MT2 (Solution)
  8. Q10a from CS 61B 19sp MT2 (Solution)