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, 04.07.2019 18:10
Acompressor receives the shaft work to decrease the pressure of the fluid. a)- true b)- false
Answers: 3
question
Engineering, 04.07.2019 18:10
Air is to be cooled in the evaporator section of a refrigerator by passing it over a bank of 0.8-cm-outer-diameter and 0.4-m-long tubes inside which the refrigerant is evaporating at -20°c. air approaches the tube bank in the normal direction at 0°c and 1 atm with a mean velocity of 4 m/s. the tubes are arranged in-line with longitudinal and transverse pitches of sl- st 1.5 cm. there are 30 rows in the flow direction with 15 tubes in each row. determine (a) the refrigeration capacity of this system and (b) pressure drop across the tube bank. evaluate the air properties at an assumed mean temperature of -5°c and 1 atm. is this a good assumption?
Answers: 1
question
Engineering, 04.07.2019 18:10
Water in a partially filled large tank is to be supplied to the roof top, which is 8 m above the water level in the tank, through a 2.2-cm-internal-diameter pipe by maintaining a constant air pressure of 300 kpa (gage) in the tank. if the head loss in the piping is 2 m of water, determine the discharge rate of the supply of water to the roof top in liters per second.
Answers: 3
question
Engineering, 04.07.2019 18:10
Slip occurs via two partial dislocations because of (a) the shorter path of the partial dislocation lines; (b) the lower energy state through partial dislocations; (c) the charge balance.
Answers: 1
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
English, 26.12.2020 17:00
question
English, 26.12.2020 17:00
Questions on the website: 13722363