subject

Consider the problem of making change for n cents using the fewest number of coins. assume that each coins value is an integer. a. you have available coin denominations of 1 cent, 5 cents, 10 cents, 25 cents, as in the us coins of penny, nickel, dime, quarter. assume there is infinite availability of each of these four coin denomination types. describe a greedy algorithm to make change using the fewest number of coins. b. consider your greedy algorithm and making change for n=30 cents. show that the optimal solution for making change includes your greedy choice. to do so, assume that your greedy choice is not in the optimal solution. then use the "cut and paste" argument to show that you can replace other coins by your greedy choice, therefore finding a better solution than what was assumed to be optimal. this is in contradiction to the assumption, so your greedy choice is in the optimal solution. c. although the greedy algorithm is optimal for the us coins, it is not necessarily optimal for any set of coins. give an example of a different set of made up coin denominations with different values, for which the greedy algorithm does not yield an optimal solution. your set should include a penny so that there is a solution for every value of n. as before, assume there is infinite availability of each of the coin denomination types. show specifically a counter example in which the greedy algorithm yields a change solution that is not optimal, that is, does not include the fewest number of coins. d. name another algorithmic approach that will find an optimal solution to your example in (c).

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 02:30, jalaholmes2027
Three out of five seniors remain undecided about a college major at the end of their senior year.
Answers: 3
image
Computers and Technology, 24.06.2019 12:30, tragicteekaay
Nikki sent flyers in the mail to all houses within the city limits promoting her computer repair service what type of promotion is this and example of
Answers: 1
image
Computers and Technology, 24.06.2019 15:00, MilanPatel
In excel, what happens to the cell contents when you click and drag a cell into multiple cells?
Answers: 1
image
Computers and Technology, 24.06.2019 18:20, 12375819
Use a while-end loop in a script file to calculate the sum of the first n terms of the series: summation sign on the top n bottom k=1 : )^k * k^2 +5k)/3^k show the script file and the two results of n = 10 and n = 20.
Answers: 2
You know the right answer?
Consider the problem of making change for n cents using the fewest number of coins. assume that each...

Questions in other subjects:

Konu
Chemistry, 10.09.2020 01:01