Optimality of Greedy Change-Making

The U.S. coin set of 1, 5, 10, 25, 50, 100 satisfies the greedy condition, meaning that if you make change for an amount greedily (always choosing the largest coin that fits in the amount left) you get a representation of A that uses the fewest possible coins. The old British system based on the halfpenny as the unit corresponds to coins 1, 2, 6, 12, 24, 48, 60, and that system is not greedy: 96 = 48 + 48 but the greedy method gets 96 = 60 + 24 + 12. An efficient algorithm due to Pearson determines whether a set satisfies the greedy condition or not, and if not, finds the smallest target amount that demonstrates the failure. The sliders in the Demonstration control the coin differences, so to see the U.S. system, set to 6 and the differences to 4, 5, 15, 25, 50.

For more details on Pearson's algorithm see
D. Pearson, "A Polynomial-Time Algorithm for the Change-Making Problem," Operations Research Letters, 33(3), 2005 pp. 231–234.
comments
 
Powered by Wolfram Mathematica
Give us your feedback
Give us your feedback

Source page:




 often  occasionally  never

Note: Please do not include anything you consider confidential or proprietary. Your message and contact information may be shared with the author of any specific Demonstration for which you give feedback, but will not otherwise be published or distributed.
Privacy Policy »

Note: To run this Demonstration you need the free
Mathematica Player
or Mathematica 7+
Download or upgrade to Mathematica Player 7
I already have Mathematica Player or Mathematica 7+