First, the recursive equation
According to the idea of divide and conquer, a recursive complexity can be written as a recursive equation.
First, the solution of the recursive equation--guess and then prove
This method is also referred to as the surrogate method, the steps are as follows:
1, the form of the Guess solution
2. Mathematical inductive method proves correct
Example:
We assume that there is a recursive formula like this:
We guess that the solution is T (n) =o (NLGN), and then the recursive substitution is
Special note: The result of our replacement must be strictly in line with conjecture, the above example if the last to arrive at T (N) <=cnlgn+1, we guessed wrong, we need to choose a new guessing formula.
Second, recursive regression equation--Recursive tree solution
The trouble with this method is that it is generally done using the surrogate method and the following master theorem
Example
For recursive equations:
Its recursive tree is as follows:
Third, Master theorem
If A>=1 and b>1, assume that there is a recursive function, the recursive type is as follows:
The following 3 articles are available:
Nan da algorithm design and Analysis course Review notes (3) l3-recursion