[Introduction to algorithms] greedy algorithms, recursive algorithms, and Dynamic Planning Algorithms

Source: Internet
Author: User

In actual life, algorithms we encounter fall into four categories:

I. Determination

Ii. Optimization Problems

Iii. Constructor

4. computing problems

The algorithm to be summarized today focuses on solving the optimization problem.

The following table summarizes the three algorithms:

Standard governance

Dynamic Planning

Greedy Algorithm

Applicable type

General problems

Optimization Problems

Optimization Problems

Subproblem Structure

Different sub-questions

Many Sub-problems are repeated (not independent)

Only one subproblem exists.

Optimal sub-structure

No

Must meet

Must meet

Number of subproblems

Resolve all sub-Problems

Resolve all sub-Problems

Only one sub-problem can be solved.

Sub-problems are in the optimal solution

All

Part

Part

Selection and solving order

Select first and then solve the sub-Problem

Resolve the sub-problem first and then select

Select first and then solve the sub-Problem

Governance algorithm features:

1) if the scale is small, it is easy to solve. // General problems can be met

2) major problems can be divided into several small-scale problems. // Prerequisite

3) The subproblem can be combined into the solution of the subproblem. // Key

4) Each subproblem is independent of each other, and the subproblem does not contain any public subproblem. // High Efficiency

[1] dynamic planning:

Dependency: Depends on the optimal choices to be made

Essence: Divide governance and solve redundancy.

Bottom-up (each step gets a smaller problem according to the strategy. Finally, the minimum scale problem is solved. Obtain the optimal solution of the entire problem)

Feature: dynamic planning of any stage I + 1 depends only on the choice made by stage I. It has nothing to do with the selection before I. However, dynamic planning not only obtains the optimal value of the current state, but also obtains the optimal value of the intermediate state.

Disadvantage: large space requirements.

[2] greedy algorithm:

Dependency: depends on all the selected items.

Top-down (that is, each step obtains the current optimal solution according to the policy. Transfer to the next step to ensure that the current best step is selected. Final result)

[3] grouping algorithm:

Essence: recursive Solution

Disadvantage: If the subproblem is not independent, you need to repeat the public subproblem.

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.