Summary of Algorithmic Strategies

Source: Internet
Author: User

The strategy is problem-oriented, and the algorithm is implementation oriented.

One, the different algorithm strategy characteristic summary 1, the greedy strategy

Greedy strategy is a simple algorithm to solve the process, on the other hand it is the most stringent conditions for the application of the problem (that is, the scope of application is very small) algorithm.

The greedy strategy solves the problem in a certain order, in the case of only considering the current local information, makes certain decision, and finally obtains the solution of the problem.

That is, the global optimal decision can be obtained by local optimal decision .

2. Recursive strategy

Recursion is also the solution of the problem, which is solved by the current problem, and relies on the recursive relationship between the information itself, each step does not need decision to participate in the algorithm, more for computing

3. Recursive strategy

Recursion is often used to divide and conquer algorithms and dynamic programming algorithms.

Recursion is the use of recursive relationships between large problems and their sub-problems to solve problems.

Algorithms that can adopt recursive strategies generally have the following characteristics:

(1) In order to solve the problem of scale N, we try to decompose it into smaller problems, and then construct the solution of large problem conveniently from the solution of these small problems.

(2) These smaller problems can also be decomposed into smaller problems by using the same decomposition and synthesis methods, and the solutions of larger problems are constructed from the solutions of these smaller problems.

(3) In particular, when the scale n = 1 o'clock, can be directly solved

4. Enumeration policy

Try all the solutions of the problem and find out the real solution of the problem. Generally used for decision-making problems, it is difficult to find the relationship between large and small scale, it is not easy to decompose the problem.

5. Recursive backtracking strategy

Similar to enumerations, by trying to traverse the path of each possible solution to the problem, when discovering blocked, go back to the previous step and try another pathway.

6. Divide and conquer strategy

The Division and treatment is generally used for more complex problems, it must be decomposed into an independent sub-problem which is easy to solve, and after solving these sub-problems, the solution of them is "synthesized", then the solution of the larger problem is obtained, and finally the solution of the total problem is synthesized.

7. Dynamic planning Strategy

Similar to greed, it also solves problems through a multi-stage decision-making process. The result of each stage decision is a sequence of decision results, in which the final result is the optimal one, depending on the decision of each subsequent stage, and of course each decision result sequence must be stored. Therefore, it is "efficient, high-consumption algorithm".

At the same time, it is similar to recursive method, when the problem can not be decomposed into independent stage, but accord with the optimization principle, we can use the dynamic programming method, through the recursive decision-making process, find out the optimal solution of sub-problem, and then the solution of the decision problem.

Second, the relationship between the algorithm strategy 1, the problem Decomposition algorithm strategy--division and dynamic programming method

Common denominator: (1) The method of divide and conquer and the dynamic programming are actually the application of recursive thought

(2) The fundamental strategy of both is to decompose the problem, to find large-scale and small-size relations, and then by solving the small-scale solution, to obtain a large-scale solution

Different points: When the problem of divide-and-conquer method is decomposed into sub-problems, there is no common sub-sub-problem between the sub-problems, but the dynamic programming method is opposite.

Dynamic Programming method = The idea of divide-and-conquer algorithm and the redundancy between solving sub-problems

2. Multi-stage approach to problem solving--greedy algorithm, recursive method, recursive method and dynamic programming method

Greedy algorithm: Each step is based on the strategy to get a result, and pass to the next step, from top to bottom, step-by-step to make greedy decision.

Dynamic programming algorithm: Each step of the decision is not a unique result, but a set of intermediate results (and these results may be multiple references in subsequent steps), but each step to reduce the size of the problem, and eventually get a result of the problem.

Recursive, recursive method: Pay attention to the relationship between each step, decision-making factors less. The recursive method is based on the derivation of the relationship from the front, and the conclusion of the small scale problem pushes out the solution of the big problem. The recursive method is to transform the big problem into a small one according to the relationship, and finally the solution of the large problem is solved by the solution of the small-scale problem.

3, comprehensively try and compare--brute force method, enumeration method, recursive backtracking method

Brute force strategy (i.e. enumeration and recursive backtracking):

When the problem can not find the relationship between information, and can not decompose the problem into independent sub-problem, only after the whole solution is listed to determine and deduce the solution of the problem.

Brute force strategy is suitable for small scale problems.

(1) Enumeration method: implementation relies on loops. So an enumeration method is only for the case of a specific problem size, for example: eight-cycle nesting algorithm for solving the problem of eight queens.

(2) Recursive backtracking: suitable for any given size, e.g. recursive backtracking to solve the problem of n Queens.

4. The central idea of the algorithm strategy

The process of solving the problem is summed up by the algorithm strategy: the basic tool of the algorithm "loop mechanism and recursive mechanism" is implemented.

Three, the problem type that the algorithm strategy focuses on

Commonly encountered problems are divided into four categories:

(1) Judgment question: Available recursive method, recursive method

(2) Calculation problem: Available recursive method, recursive method

(3) Optimization problems: greedy algorithm, divide and conquer method, dynamic programming method, enumeration method

(4) Structural problems: greedy algorithm, divide and conquer method, breadth first search, depth first search

Summary of Algorithmic Strategies

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.