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
Explain the difference laminar and turbulent flow. explain it with the shear stress and the velocity profiles.
Answers: 1
question
Engineering, 03.07.2019 14:10
When at a point two solid phase changes to one solid phase on cooling then it is known as a) eutectoid point b) eutectic point c) peritectic point d) peritectoid point
Answers: 3
question
Engineering, 04.07.2019 18:10
Consider a large isothermal enclosure that is maintained at a uniform temperature of 2000 k. calculate the emissive power of the radiation that emerges from a small aperture on the enclosure surface. what is the wavelength ? , below which 10% of the emission is concentrated? what is the wavelength ? 2 above which 10% of the emission is concentrated? determine the wavelength at which maximum spectral emissive power occurs. what is the irradiation incident on a small object placed inside the enclosure?
Answers: 2
question
Engineering, 04.07.2019 18:10
Shafts are machine elements that are used to a) carry axial loads b) direct shear loads c) transmit power d) rotate at constant speed e) none of the above circular and square shafts subjected to the same torque under the same circum behave a) the same way b) almost the same way
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, 05.03.2021 20:40
question
Mathematics, 05.03.2021 20:40
Questions on the website: 13722363