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.
Recommended Problems
- 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
- Q4c from CSE 373 19au MT (Solution)
- Q3a, Q3b from CSE 373 19au Final (Solution)
- Q5 from CS 61B 15sp MT2 (Solution)
- Q9 from CS 61B 16sp MT2 (Solution)
- Q4b from CS 61B 17sp MT2 (Solution)
- Q5 from CS 61BL 17su MT2 (Solution)
- Q10a from CS 61B 19sp MT2 (Solution)