http://en.wikipedia.org/wiki/Change-making_problem
Given unlimited amounts of coins of denominations d1 > … > dm , must contain 1.
give change for amount n with the least number of coins.
Does the greedy algorithm always give an optimal solution for the general change-making
problem We give the following example,
Example: d1 = 7c, d2 =5c, d3 = 1c, and n = 10c, not always produces an optimal solution. in fact, for some instances, the
problem
may not have a solution at all! consider instance d1 = 7c, d2 =5c, d3 = 3c, and n = 11c.
But, this
problem
can be solved by dynamic programming, please try to design an algorithm for the general
Change-making_problem after class.
该算法复杂度为O(NK)
探讨了硬币找零问题中的贪心算法局限性,并通过动态规划算法解决了该问题,实现了找出构成特定金额所需的最少数量硬币的方法。

2183

被折叠的 条评论
为什么被折叠?



