A new coin that is worth exactly 4 cents has been add to our currency system. Prove or disprove the statement: "The cashier`s algorithm using quarters, dimes, nickels, 4 cent coins, and pennies and will always produce change using the fewest coins possible
A new coin that is worth exactly 4 cents has been add to our currency system. Prove or disprove the statement: "The cashier`s
pennies and will always produce change using the fewest coins possible."
Allow us first to demonstrate unequivocally that the coin - changing issue has ideal foundation.
Assume we have an ideal answer for an issue of making change for n pennies, and we realize that this ideal arrangement utilizes a coin whose worth is c pennies; let this ideal arrangement utilize k coins. We guarantee that this ideal answer for the issue of n pennies should hold inside it an ideal answer for the issue of n - c pennies. We utilize the standard reorder contention. Obviously there are k - 1 coins in the answer for the n - c pennies issue utilized inside our ideal answer for the n pennies issue. Assuming we had an answer for the n - c pennies issue that utilized less than k - 1coins, then, at that point, we could utilize this answer for produce an answer for the n pennies issue that utilizes less than k coins, which goes against the optimality of our answer.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 7 images