Question: In class, we showed that the cashier's algorithm ( repeatedly taking the largest coin possible ) is not optimal for the currency 1 , 5
In class, we showed that the cashier's algorithm repeatedly taking the largest coin possible is not optimal for the currency Unfortunately, we have to solve this problem using dynamic programming.
a Let be the integervalued function that describes the fewest number of coins needed to make change for cents, using the currency for Describe a mathematical recurrence for
b Use your recurrence to devise a dynamic programming algorithm in pseudocode for computing this function. Your algorithm should be iterative and of the form:
CoINDP :
your code here
What's the runtime of your algorithm?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
