Change coin problem with 0-1 knapsack problem difference

Source: Internet
Author: User

The reason why write a blog, is because many problems in reality can be converted into a "change coin" problem and "0-1" knapsack problem. Therefore, need to understand carefully.

Secondly, some blogs and learning materials about greedy algorithm and dynamic programming are summarized in "reference material".

Difference:

In fact, the biggest difference is: to find coins in the problem of a certain type of coin can be selected multiple times. And for the 0-1 knapsack problem, an item is either selected, or not selected, after the election, it is "gone." Of course, there are 0-1 knapsack problems------------a complete knapsack problem--a certain (category) item has multiple, repeatable selection.

The second is the tradeoff of choice. 0-1 knapsack problem, there is a value attribute, in the choice of time, is to consider the maximization of value . The weight is equal to cost, while value is values.

For coins, it is not so complicated. From this point of view, it is easier to find a coin change problem. But it focuses on using fewer coins. so when considering other issues, judge whether it's about maximizing value or focusing on the least number.

Resources:

The correctness proof of greedy algorithm for partial knapsack problem

The correctness proof of some greedy algorithm for changing coins problem

The difference and relation between dynamic programming and greedy algorithm from the viewpoint of activity selection

Solving the longest common subsequence of two strings

Given an integer, the number of FIB numbers can be added to solve the integer at least

"Backpack Ninth Lecture"

https://www.zhihu.com/question/23995189 on the discussion of dynamic planning thought

Change coin problem with 0-1 knapsack problem difference

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.