Recursive Algorithms and Recurrence Equations



Overview



Analyzing Performance of Non-Recursive Routines is (relatively) Easy



Performance of Recursive Routines



Performance of Factorial



Performance of Fibonacci



Performance of Recursive Binary Search



Recurrence Equation - Definition and Examples



Technical Issues



Reminder: $\Theta(n)$ on the RHS



Recurrence Equations - Solution Techniques



Example Using Induction: Factorial



Example Using Induction: Binary Search



Recursion Tree



Example Recursion Tree



Example Recursion Tree



Tree Properties



Recursion Tree for $T(n) = aT(\frac{n}{b}) + f(n)$



Summing the Values in the Tree



Fine Points



Evaluating the Complexity of the Sum of the Tree Levels



Specifying How One Term Dominates Another



General Master Method



Examples



Master Method from Text



Master Method from Text is a Simplification of the General MM



Other Methods for Solving Recurrence Equations



Homogenous Linear Recurrence Equations



Homogenous Linear Recurrence Equation: Example



Non-homogenous Linear Recurrence Equations



Change of Variable



Substitution