subject
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.

ansver
Answers: 2

Another question on Engineering

question
Engineering, 03.07.2019 14:10
If the thermal strain developed in polyimide film during deposition is given as 0.0044. assume room temperature is kept at 17.3 c, and thermal coefficient of expansion for the film and the substrate are 54 x 10^-6c^-1 and 3.3 x 10^-6c^-1respectively. calculate the deposition temperature.
Answers: 3
question
Engineering, 04.07.2019 18:10
The temperature of air decreases as it is compressed by an adiabatic compressor. a)- true b)- false
Answers: 2
question
Engineering, 04.07.2019 18:10
If a particle moves along a path such that r : (3 sin t) m and ? : 2t rad, where t is in seconds. what is the particle's acceleration in m/s in 4 seconds? a)- 16.43 b)- 16.29 c)- 15.21 d)- 13.79
Answers: 1
question
Engineering, 04.07.2019 18:20
Vibration monitoring this technique uses the noise or vibration created by mechanical equipment and in seme cases by plant systems to detemine their actual condtion. a)- true b)- false
Answers: 2
You know the right answer?
A grocery store has a policy that when the cashiers give change back to the customers, they should u...
Questions
question
Mathematics, 04.10.2019 22:00
Questions on the website: 13722361