ArticleDirectory
- The progressive advanced method for solving recursive equations -- the Generation Method
The progressive advanced method for solving recursive equations -- the Generation Method
This method can be used to estimate both the upper and lower bounds. As mentioned above, the key step of the method is to speculate on the answer in advance, and then use mathematical induction to prove the correctness of the speculation.
For example, we need to estimate the upper bound of T (N). T (n) satisfies the recursive equation:
Here is the sign of the floor (floors) function, indicating the maximum integer not greater than N.
We suppose T (n) = O (NLogN), that is, it is estimated that there are positive constants c and natural numbers N0, so that when n is ≥n0, there are:
T(N) ≤CNLogN(6.2)
In factN0 = 22 = 4, and take
Then, whenN0 ≤N≤ 2NWhen 0, (6.2) is set up. This induction assumes that when 2K-1N0 ≤N≤ 2KN0,K(1.1.16) is valid if the value is greater than or equal to 1. Then, when 2KN0 ≤N≤ 2K+ 1NWhen 0, we have:
That is, (6.2) is still valid, soN≥N0, (6.2) was set up. We can see that our speculation is correct. Therefore, it is concluded that the approximate order of the solution of the recursive equation (6.1) isO(NLogN).
The limitation of this method is that it is only suitable for Recursive equations that are easy to guess the answer or experts who are good at speculation. There is no general method to predict the correct solution of recursive equations. We have to rely on Experience Accumulation and insights. Here we provide three suggestions:
(1) it is reasonable to assume that a recursive equation has a similar solution if it is similar to an equation that you have known before. For example, consider the recursive equation:
A number 17 is added to the variable on the right, making it difficult to guess the equation. However, it is similar in form to (6.1. In fact, when n is large enough
And
Almost the same. Therefore, we can infer that (6.3) and (6.1) have a similar upper bound.T(N) =O(NLogN). Further, mathematical induction will prove that this speculation is correct.
(2) start to speculate from a more relaxed world and gradually approach the exact world. For example, for Recursive equations (6.1), we need to estimate the approximate lower bound of their solutions. ObviouslyT(N) ≥N, We can speculateT(N) =Ω(N) First, after finding it too loose, you can get it by raising the speculative order.T(N) =Ω(NLogN.
(3) replacing the variable element sometimes turns a recursive equation with the last known solution into an equation with the known solution you have seen, so that the required solution can be obtained as long as the variable element of the correct solution of the transformed equation is used as the inverse transformation. For example, consider recursive equations:
It looks complicated, because the right-side variable has a root number. HoweverM= LogN, Instant orderN= 2M, Replace it with (6.4), then (6.4) becomes:
SetMIf the limit is set to a positive or even number, (6.5) can be rewritten:
T(2M) = 2T(2M/2) +M
IfS(M) =T(2M), ThenS(M) Recursive equation:
S(M) = 2S(M/2) +M,
Similar to (6.1), there are:
S(M) =O(M1ogM),
Then we can getT(N) =T(2M) =S(M) =O(M1ogM) =O(LogNLoglogN) (6.6)
The above arguments only show that: when (sufficiently large)NIt is a positive power of 2 or a positive integer of 4 (6.6. Further analysis shows that (6.6) is a positive integer of all sufficiently large values.NAre true, so that the approximate order of the solution of the recursive equation (6.4) is estimated.
When using the proxy method, there are three reminders:
(1) markOIt cannot be abused. For example, when estimating the upper bound of the (6.1) solution, someone may speculateT(N) =O(N).N, YesT(N) ≤CN, WhereCIs a positive constant. He further uses mathematical induction to launch:
So that speculationT(N) =O(N) Is correct. In fact, this assumption is wrong because he abused the mark.O, Mistakenly put (C +L)NAndCNEquivalent.
(2) When there is no doubt about the approximate order of the solutions of recursive equations, but it cannot be proved by mathematical induction, we may try again by subtracting a low-order term from the original speculation. As an example, consider recursive Equations
Here is the mark of the ceiling function. We assume that the approximate upper bound of the solution isO(N). We will try to prove the proper number for the appropriate choiceCAnd Natural NumberN0, whenN≥NWhen 0T(N) ≤CN. Place Our speculation into the recursive equation and get:
We cannot infer from thisT(N) ≤CNThe induction method has encountered obstacles. The reason is that the right-end ratio of (6.8)CNAn extra low-level constant. To offset this low order, we can subtract a undetermined low order from the original conjecture.BThat is, the original assumption is:T(N) ≤CN-B. Now let's present it (6.7) and get:
As longB≥1, the new speculation will be passed in the induction.
(3) because we need to estimate the gradual order of the solution of the recursive equation, we do not need to make any speculation on the initial conditions of the recursive equation (suchT(0 ),T(1) IfT(N).NLarge enough. For example, we speculate on the solution (6.1 ).T(N) ≤CNLogNAnd has been proved to be correct, but whenN= L, this speculation is not true, because (CNLogN) | N = 1 = 0 andT(L)> 0.