the method of solving recursive type
"Substituting Law"
- The solution of substituting method is divided into two steps:
- The form of guessing solutions
- By using the mathematical induction method to find out the constant c of the solution, and prove the correctness, the key step is to use the guessed solution into the recursive formula.
- Make good guesses (no general method, only experience)
- Similar to the solution you have seen, guess it.
- The upper and lower bounds of the first pass are more relaxed, and the guessing range is reduced. We can start with the nether Ω (N), the upper bound O (n^2), and then gradually converge to (NLOG2N)
- Detail correction
- Sometimes the guessing solution is correct, but the mathematical induction does not directly prove its details, because the mathematical induction is not strong enough to prove its details.
- a lower order can be subtracted from the guess solution to satisfy the mathematical induction method.
- Avoid traps
- Similar to the summation mathematical induction method, it is proved that the use of asymptotic notation is prone to error.
- such as: proof O (n) must be strictly proved ≤CN, can not be said to change to do cn+n
- Variable transformation
- Sometimes changing variables can make an unknown recursive into a familiar formula. For example:
"Substituting law questions"
"Recursive Tree Method"
- Recursive trees are best used to generate good guesses, and then use the surrogate method to verify that the guesses are correct.
- Need attention:
- Number of iterations required to reach the boundary condition
- The and formula in the iterative process. If the form of the solution has been estimated in the iterative process, it can also be used in the method of substituting
"Recursive tree Law Question"
"Master principle"
theorem 4.1 (principal theorem) makes a≥1 and b>1 a constant, f (n) is a function, and T (n) is a recursive formula defined on a nonnegative integer:
T (n) = at (n/b) + f (n)
Which we will explain n/b as. Then T (n) has the following asymptotic bounds:
The three cases of the main theorem, after analysis, can be found to be the F (n) and comparison.
The first case is greater, the second case is equal to f (n), and the third case is F (n) greater.
"Main theorem Example"
The method of "algorithm review" to solve recursive formula