Question: Consider the problem of making change for n cents using the fewest number of coins. Assume that each coin's value is an integer. a. Describe

Consider the problem of making change for n cents using the fewest number of coins. Assume that each coin's value is an integer.
a. Describe a greedy algorithm to make change consisting of quarters, dimes, nickels, and pennies. Prove that your algorithm yields an optimal solution.
d. Give an O (nk)-time algorithm that makes change for any set of k different coin denominations, assuming that one of the coins is a penny.

Step by Step Solution

3.45 Rating (148 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Before we go into the various parts of this problem let us rst prove once and for all that the coinchanging problem has optimal substructure Suppose w... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

C-S-A (102).docx

120 KBs Word File

Students Have Also Explored These Related Algorithms Questions!