Suppose that the coins of the fictional country of Combinatoria come in the denominations, d 1 ,
Question:
Suppose that the coins of the fictional country of Combinatoria come in the denominations, d1, d2,...,dk, where d1 = 1 and the other di values form a set of distinct integers greater than 1. Given an integer, n > 0, the problem of making change is to find the fewest number of Combinatorian coins whose values sum to n.
(a) Give an instance of the making-change problem for which it is suboptimal to use the standard greedy algorithm, which repeatedly chooses a highest-valued coin whose value is at most n until the sum of chosen coins equals n.
(b) Describe an efficient algorithm for solving the problem of making change. What is the running time of your algorithm?
Step by Step Answer:
Algorithm Design And Applications
ISBN: 9781118335918
1st Edition
Authors: Michael T. Goodrich, Roberto Tamassia