Engineering
Engineering, 14.06.2021 16:00, andrecoral105

A grocery store has a policy that when the cashiers give change back to the customers, they should use the fewest number of coins.1. Suppose that the store has infinite supplies of quarters (25 cents), dimes (10 cents), nickels (5 cents), and pennies (1 cent). Describe a greedy algorithm to make change using the fewest number of coins.2. If the store runs out of nickels (5 cents), then the greedy algorithm may not yield an optimal solution for some amounts of change. What is the smallest amount n in this case that the greedy algorithm fails to make change using the fewest number of coins?3. Suppose that the government adopts a different set of coin denominations, consisting of k denominations. Give an O(nk)-time dynamic-programming algorithm that makes change for any amount n using the fewest number of coins. This algorithm should work for any set of k coin denominations, as long as it includes a penny.

answer
Answers: 2

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, mm016281
What difference(s) did you notice using a pneumatic circuit over hydraulic circuit. explain why the pneumatic piston stumbles when it hits an obstacle.
Answers: 2
image
Engineering, 04.07.2019 18:10, soreese02
An ideal otto cycle with air as the working fluid has a compression ratio of 8. the minimum and maximum temperatures in the cycle are 300 k and 1340 k. use constant specific heats at room temperature to determine (a) the amount of heat transferred to the air during the heat- addition kj/kg, (b) the thermal efficiency, and (c) the thermal efficiency of a carnot cycle ope limits. process, in rating between the same temperature
Answers: 2
image
Engineering, 04.07.2019 18:20, DroctorWellsfan
Inspection for bearing condition will include: (clo4) a)-color b)-smell c)-size d)-none of the above
Answers: 1
image
Engineering, 04.07.2019 18:20, mjcbs21
What is the heat treatment of metals? what is the benefit of it? why and how it's useful? answer in details, do not write by hand.
Answers: 3
Do you know the correct answer?
A grocery store has a policy that when the cashiers give change back to the customers, they should u...

Questions in other subjects:

Konu
English, 02.06.2021 14:00
Konu
Mathematics, 02.06.2021 14:00
Konu
Mathematics, 02.06.2021 14:00