Introduction to algorithms-scattered notes

Source: Internet
Author: User

Chapter 2AlgorithmGetting started

Divide and conquer method-algorithms are commonly used when the structure is recursive.

Chapter 4 Dynamic Planning

I. The optimal solution of a problem contains an optimal solution of its subproblems, which is the optimal sub-structure. One problem with the optimal sub-structure is that dynamic planning may be applicable (or greedy algorithms ).

You can use the optimal solution of a subproblem to construct an optimal solution.

Sub-problems are independent, that is, the solution of a sub-problem does not affect the solution of other sub-problems, in order to have an optimal sub-structure.

A common mode that can be followed:

1) One solution to the problem can be to make a choice. For example, select an assembly station.

2) for a given problem, it is known that it is a choice that can lead to the optimal solution (the optimal solution of the sub-problem), and you do not have to worry about how to determine this choice.

3) determine which sub-problems will occur and how to describe the sub-problems.

4) "Clipboard": Used to prove that the solution of the subproblem used is also optimal in an optimal solution of the problem. That is, anyway.

II. Subproblem overlap is the second sign of dynamic planning. The bottom-up table method calculates the optimal cost.

3. The dynamic planning time depends on two factors: the total number of subproblems and the number of choices for each subproblem.

Example: LCs problem: describe the structure of the optimal solution --> recursively define the value of an optimal solution --> calculate the value of the optimal solution --> construct the optimal solution

(LCS is a dynamic planning algorithm for removing sub-problems due to the problem conditions, and the editing distance is also. Neither assembly line scheduling nor matrix chain multiplication)

Chapter 4 basic graph algorithms

I. Breadth-first search)

Queue Shortest Path
Breadth priority tree

II. Deepth-first search)

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.