Ask Question
22 June, 07:12

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.

+5
Answers (1)
  1. 22 June, 08:23
    0
    the answer is B ...
Know the Answer?
Not Sure About the Answer?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers