Question: Suppose the coinage includes the values given in Section 6.1, but you have run out of nickels. Show that using the greedy algorithm with the

Suppose the coinage includes the values given in Section 6.1, but you have run out of nickels. Show that using the greedy algorithm with the remaining values does not necessarily produce an optimal solution. Section 6.1 function {make-change} (n): set of coins {Makes change for n units using the least possible number of coins. The constant C specifies the coinage} const C = {100, 25, 10, 5, 1} S leftarrow empty set{S is a set that will hold the solution} s leftarrow 0 {s is the sum of the items in S} while s not equal to n do x leftarrow the largest item in C such that s + x
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
