Question: a. Write pseudocode (or actual code) of a greedy algorithm for the change-making problem with an amount n and coin denominations d_1 > d_2 >

a. Write pseudocode (or actual code) of a greedy algorithm for the change-making problem with an amount n and coin denominations d_1 > d_2 > ... > d_m as its input. Assume that the number of coins of each denomination d_i is unlimited. The code should simply determine the minimum number of coins that sum up to n (don't worry about which change is required).

b. What is the asymptotic efficiency of your algorithm?

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!