Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Describe an efficient greedy algorithm for making change for a specified value using a minimum number of coins, assuming there are four denominations of

Describe an efficient greedy algorithm for making change for a specified value using a minimum number of

Describe an efficient greedy algorithm for making change for a specified value using a minimum number of coins, assuming there are four denominations of coins (called dimes, nickels, quarters, and pennies), with values 10, 5, 25, and 1, respectively. The input of your algorithm is an integer number N representing the total number of cents. The out put specifies for each denomination how many coins are to be used. Here, "efficient" means O(N). 1. Present pseudocode, running time analysis, proof of correctness. 2. Find four denominations of coins, one of which is 1 cent, and one value of N for which the greedy algorithm fails to return the minimum number of coins. Show the greedy and optimum solutions. 3. Present a dynamic program for any set of k denominations. Strive for running time of O(kN), but make sure that the running time is polynomial in k and N. Present the pseudocode, discuss correctness, and analyze the running time.

Step by Step Solution

3.41 Rating (160 Votes )

There are 3 Steps involved in it

Step: 1

Lets break down the steps for the greedy algorithm to make change for a specified value using the mi... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Structures and Algorithms in Java

Authors: Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser

6th edition

1118771334, 1118771338, 978-1118771334

More Books

Students also viewed these Programming questions

Question

(a) Prove Theorem 4, part 3. (b) Prove Theorem 4, part 5

Answered: 1 week ago

Question

hwo do carbon accountants help tackle climate change?

Answered: 1 week ago

Question

Describe early attempts to use traits to conceptualize personality.

Answered: 1 week ago