Question: Note: Please use the recommended text book as Introduction to Algorithms (3rd Edition). Please post the answers in text format. 6. Consider the problem of

 Note: Please use the recommended text book as Introduction to Algorithms

Note: Please use the recommended text book as Introduction to Algorithms (3rd Edition).

Please post the answers in text format.

6. Consider the problem of making change for n cents using the fewest number of coins. Assume that each coin's value is an integer. [10 points] a) Describe a greedy algorithm to make change consisting of quarters (25 cents each), dimes (10 cents each), nickels (5 cents each), and pennies (1 cent each). Prove that your algorithm yields an optimal solution b) Give a set of coin value combination (the value of coins may not be limited to quarter, dime, nickel, or penny) for which the greedy algorithm does not yield an optimal solution. Use an example to justify your answer. Note that your set should include a penny value so that there is a solution for every possible value of n

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!