An advanced method for solving recursive equations -- using the formula

Source: Internet
Author: User
ArticleDirectory
    • An advanced method for solving recursive equations -- using the formula
An advanced method for solving recursive equations -- using the formula

This method is like:

T(N) =At(N/B) +F(N) (6.17)

Provides three applicable formulas for the gradual order of the solutions of recursive equations. In (6.17)A≥1 andB≥1 is a constant,F(NIs a definite positive function.

(6.17) is a type of recursive relationship satisfied by the time complexity of the division and control method. That is, a problem with a scale of N is divided into scales.N/BOfASub-questions, recursively solve this problemASub-problems, and thenAThe synthesis of sub-questions to get the solution of the original problem. If you useT(N) Indicates that the scale isNThe complexity of the original problem.F(N) Indicates dividing the original problemASub-questions andAWe have an equation (6.17) when we combine the time required to solve the original problem ).

This method is based on the following theorem:A≥1 andB≥1 is a constantF(NIs a definite non-negative function defined on a non-negative integer. ResetT(N) Is also a non-negative function defined on a non-negative integer and satisfies the recursive equation (6.17 ). In equation (6.17)N/BIt can be [N/B], Or yesN/B. InF(NIn three cases, we haveT(N:

    1. For a constantε> 0,
      ,
      Then
      ;
    2. If
      ,
      Then
      ;
    3. If the constantε> 0,

      And for a constantC> 1. All integers that are sufficiently largeNYesAF(N/B) ≤Cf(N), ThenT(N) =θ(F(N)).

Here we omit the proof of theorem.

Before applying this theorem to some examples, let's first point out the intuitive meaning of the theorem to help readers understand this theorem. Readers may have noticed that all the three cases involved here referF(N. The Theorem intuitively tells us that the approximate order of the solutions of recursive equations is determined by the greater ones in these two functions. In the first case, the function is largeT(N) =θ(); In the third case, the functionF(N) Larger, thenT(N) =θ(F(N); In the second case, if the two functions are the same sizeT(N) =θ(), That isNLogarithmF(N) AndT(N.

In addition, some details in the theorem cannot be ignored. In the first caseF(N) Must not only be smaller, but also be less polynomial, that isF(N) Must be incrementally less than the product of the sum,εIs a positive constant; in the third caseF(N) Not only must the ratio be larger, but also must be Polynomial-to-ground ratio greater, but also must meet the additional "conventional" conditions:AF(N/B) ≤Cf(N). The intuitive meaning of this additional "conventional" condition isAThe time required for re-decomposition and re-Synthesis of sub-questions is at most the same level as the time required for the decomposition and synthesis of the original question. In general, the polynomial-based functions we encounter basically satisfy this conventional condition.

It is also important to realize that the above three situations do not cover all possible situations.F(N). There is a gap between the first and second situations:F(N) Smaller than but not polynomial less than; similarly, there is a gap between the second and third cases:F(N) Larger than but not polynomial. If the FunctionF(N) In one of these two gaps, or even though the conventional conditions are not met, this theorem is powerless.

Below are several application examples.

Example 1Considerations

T(N) = 9T(N/3) +N0

Compared with (6.17), we haveA= 9,B= 3,F(N) =N, Take, there is, you can apply the first type of situation formula, getT(N) =θ(N2 ).

Example 2Considerations

T (n) = T (2n/3) + 1

For comparison (6.17), we have a = 1, B = 3/2, F (n) = 1, and the formula for the second case can be used to obtain T (n) = θ (logn ).

Example 3Considerations

T (n) = 3 T (N/4) + nlogn

For comparison (6.17), we have a = 3, B = 4, F (n) = nlog N, as long as we take it, there will be. Further, check the conventional conditions:

As long as c = 3/4 is used, AF (N/B) is ≤cf (N), that is, the conventional conditions are also met. The formula for the third case can be used to obtain T (n) = θ (f (N) = θ (nlogn ).

Finally, we will give an example of this method's powerlessness.

Considerations

T(N) = 2T(N/2) +NLogN

Compared with (6.17), we haveA= 2,B= 2,F(N) =NLogN, AlthoughF(N) Progressively larger than,F(N) It is not a polynomial larger than that of any normal number.ε,

,

That isF(NIn the gap between the second case and the third case, this method is powerless.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.