The coin change problem
What are the best denominations of 4 coin values to minimize the coins needed to make any value from one cent to 99 cents? How optimum is are the US values of 25, 10, 5 and 1 cent? Are there better values? How much does adding the 50 cent coin improve the situation?
Wrote a TIbasic function misc\change(val_list,amt) which returns the number of coins of each denomination needed to make 'amt'. val_list is a list of descending coin denominations. The penalty function P is the sum of the number of coins to make each amount from 1 cent to 100 cents. For example, misc\change({25,10,5,1},99) returns {3, 2, 0, 4}, for a total of 9 coins. Some coin values & P values:
{25,10,5,1} 470
{50,25,10,5,1} 420 (50cent piece improves P by 50)
{32,8,4,1} 450
{32,16,4,1} 450
Wrote a TIbasic function misc\change(val_list,amt) which returns the number of coins of each denomination needed to make 'amt'. val_list is a list of descending coin denominations. The penalty function P is the sum of the number of coins to make each amount from 1 cent to 100 cents. For example, misc\change({25,10,5,1},99) returns {3, 2, 0, 4}, for a total of 9 coins. Some coin values & P values:
{25,10,5,1} 470
{50,25,10,5,1} 420 (50cent piece improves P by 50)
{32,8,4,1} 450
{32,16,4,1} 450
0 Comments:
Post a Comment
<< Home