Question: Greedy strategy a. does using the greedy algorithm for making change of n cents give a correct solution if a nickel was worth 6 cents
Greedy strategy a. does using the greedy algorithm for making change of n cents give a correct solution if a nickel was worth 6 cents instead of 5? (we have 1, 6, 10 and 25 cent coin denominations). b. We have n unique items. For i = 1, 2, 3, ellipsis, n, each item has a weight w_i > 0 and value v_i > 0. Write a greedy algorithm to find the maximum value of items that can be carried in a knapsack with a maximum weight capacity of W. An item may be broken into pieces and only a fraction put into the knapsack. It should take an array of weights, an array of item values and the weight limit of the knapsack as input. The array of weights and items are ordered such that w_i corresponds to the same item as v_i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
