Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. (10 points) Show that if there were a coin worth 9 cents, the greedy algorith

ID: 3781414 • Letter: 2

Question

2. (10 points) Show that if there were a coin worth 9 cents, the greedy algorithm using quarters, dimes, 9-cent coins, nickels, and pennies would not always produce change using the fewest coins possible. Note: for full credit, you need to find an example where the greedy algorithm does not produce change using the fewest coins possible, and then describe why this example works: trace the greedy algorithm to explain how many coins it would produce in change? what’s a better way to make change using fewer coins? Second note: for worked examples related to this question, refer to Week 1 discussion section worksheet

Explanation / Answer

The algorithm can use maximum number of quarters, three, leaving 9 cents coins. It can use maximum number of dimes, one penny.Greedy algorithm will work.

The greedy algorithm is having one quarter, leaving 9 cents coin , then 8pennies total of 9 coins.

Thus gredy algorithm is not correct for this coins.

Thank you.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote