In: Computer Science
Suppose that we want to make change for n cents using the least number of coins. The coins are of denominations c 0 , c 1 , . . . , c k for some integers c > 1, and k ≥ 1. (a) Design a greedy algorithm to solve this problem. (b) Prove that your algorithm finds an optimal solution by showing the greedy-choice property and optimal substructure for it. Clearly state each property and then prove them.
Answer a). Always give the highest denomination coin that you can without going over. Then, repeat this process until the amount of remaining change drops to 00.
Answer b)
Let the coin denominations be {1, 3, 4}{1,3,4}, and the value to make change for be 66. The greedy solution would result in the collection of coins {1, 1, 4}{1,1,4} but the optimal solution would be {3, 3}{3,3}.
note: plzzz don't give dislike.....plzzz comment if you have any problem i will try to solve your problem.....plzzz give thumbs up i am in need....