Common algorithms and problem scenarios--greedy algorithm __ The beauty of mathematics

Source: Internet
Author: User
General statement

1, solve the idea: The problem is decomposed into multiple sub problems, as long as the optimal solution of the sub problem is obtained, we can get the optimal solution of the final problem. That is, we need to consider the local optimal, we can get the global optimal.
2, limitations: the need to identify a problem with the above characteristics, to use the greedy algorithm to solve. Applicable Scenarios

1, Single-source Shortest road problems
2. Minimum spanning tree problem
3, can arbitrarily split knapsack problem. If you can not arbitrarily split, you need to use dynamic programming solution.
4, in some cases, even if the greedy algorithm can not get the overall optimal solution, the final result is a good approximation of the optimal solution.
5. Arrangement of activities

A set of n active time, each activity uses the same resource, such as a conference field, and only one activity can be used at the same time, each activity has a start of the active Si and end time fi, which is his use interval for (SI,FI), now asks you to allocate the activity to occupy the schedule, That is, which activities occupy the conference room, which does not occupy, so that they do not conflict, the requirement is to maximize the participation of activities, that is to maximize the time interval.

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.