Analyze Recurrences
The Iteration Method
Steps:
- Expand the recurrence a few times.
- Write the expanded form as a summation.
- Simplify the summation.
- Substitute the base condition to get the result.
Example 1
Given that:
Firstly, expand it.
Then, assume that:
Finally, substitute it to the original expression:
Example 2
Given that:
Then
Since when , , so we assume that finally.
Then
Use Stirling’s formula,
The Substitution/Induction Method
Steps:
- Guess the result form.
- Prove by induction.
Example
Given that
Firstly, we guess that
So we need to prove that
Assume that
Then the inductive steps are:
Recursion Tree Method
Draw the recursion tree and calculate the cost of each level which start at .
Master Method
Suppose that we have:
- is the size of the current problem.
- is the number of sub problems of the recursion.
- is the size of each sub problem.
- is the cost of each level recursion.
Then we have three theorems:
- If , then
- If , then
- If , and if for some , and all sufficiently large , then .
Example 1
Given that
Then
Example 2
Given that
Then
Example 3
Given that
Then
Before applying case 3, we need to check the regularity condition, which means that where should be true.
When , the expression is true. So the condition check is successfully.
Last updated on