Ask 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 a greedy algorithm to make change consisting of quarters, dimes, nickels, and pennies. Prove that your algorithm yields an optimal solution. b. Suppose that the available coins are in the denominations that are powers of c, i. e., the denominations are c0, c1, ..., ck for some integers c > 1 and k % 1. Show that the greedy algorithm always yields an optimal solution. 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. 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.

+3
Answers (1)
  1. 26 October, 13:55
    0
    the answer is B ...
Know the Answer?
Not Sure About the Answer?
Find an answer to your 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. ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers