Def Recurrence
A recurrence is an equation/inequality according to which the
Fact Three Methods for Recurrence Analysis
- Substitution Method: Guessing the closed form using substitution and then prove by induction.
- Recursion Tree: Guessing the closed form using the recurrence tree and then prove by induction.
- Master Theorem: Finding asymptotic bounds of some recurrences using predefined rules.
Def Recursion Tree Recursion Tree is a tree where:
- Each node represents a single sub-problem along with the cost of the particular sub-problem.
- An edge from node 𝑣 to node 𝑢 means that the sub-problem represented by node 𝑣 calls the sub-problem represented by node 𝑢.
e.g. For the recurrence
Note that not all leaves are in the last level. Hence total cost is at most
Master Theorem
Thrm Master Theorem
Consider
- If
for some constant , then . - If
, then . More generally, if for some integer , then . - If
for some constant and if for some constant and , then . e.g. Consider . Here , , . Hence . Therefore by second case of Master theorem we have .