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

3. Consider the problem of making changes 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 pen XL18 nies. b. Suppose that the available coins are in the denominations that are powers of c, i.e., the denominations are c, c', ck for some integers c>1 and k >=1. Describe a greedy algorithm. c. Give a set of coin denominations for which the greedy algorithm does not yield an optimal solution. Your set should include a penny so that there is a solution for every value of n. You only need to give at least one example.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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

Students Have Also Explored These Related Programming Questions!