Question: please show all work 2. Coin Changing Problem Suppose you are given an unlimited supply of coins in each of the n denominations d =

please show all work
please show all work 2. Coin Changing Problem Suppose you are given

2. Coin Changing Problem Suppose you are given an unlimited supply of coins in each of the n denominations d = (di, d2...., dn), and a number N of monetary units to be paid out using the least possible number of coins. a. Show that this problem exhibits optimal substructure, i.e. show how to divide the problem into subinstances of the same problem in such a way that every subinstance solution is a combination of other subinstance solutions. b. Write a recurrence relation for the value of an optimal solution. Include boundary and out of bounds values. c. Write a dynamic programming algorithm that fills in a table of values defined by the recurrence relation you wrote in (b). Your algorithm should take as input the vector d and the number N, and return the value of an optimal solution, i.e. the least number of coins necessary to pay N units, or returns oo if it is not possible to disburse N units using denominations d. d. Write a recursive procedure that, given the table of sub-instance solutions generated by the algorithm in (c), prints out a list of coins to be disbursed, i.e. print the optimum solution itself. 2. Coin Changing Problem Suppose you are given an unlimited supply of coins in each of the n denominations d = (di, d2...., dn), and a number N of monetary units to be paid out using the least possible number of coins. a. Show that this problem exhibits optimal substructure, i.e. show how to divide the problem into subinstances of the same problem in such a way that every subinstance solution is a combination of other subinstance solutions. b. Write a recurrence relation for the value of an optimal solution. Include boundary and out of bounds values. c. Write a dynamic programming algorithm that fills in a table of values defined by the recurrence relation you wrote in (b). Your algorithm should take as input the vector d and the number N, and return the value of an optimal solution, i.e. the least number of coins necessary to pay N units, or returns oo if it is not possible to disburse N units using denominations d. d. Write a recursive procedure that, given the table of sub-instance solutions generated by the algorithm in (c), prints out a list of coins to be disbursed, i.e. print the optimum solution itself

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 Databases Questions!