Question: orkshe Greedy Algorithm 1. 0-1 arid Cortinueus Knapsack Problem: Consider the 0-1 knapsack problem. Consider the following three strategies. State whether any of . these

orkshe Greedy Algorithm 1. 0-1 arid Cortinueus Knapsack Problem: Consider the 0-1 knapsack problem. Consider the following three strategies. State whether any of . these strategies provide correct solution to the problem in all cases. If the answer is no, then provide a counterexample with numbers clearly stating the correct solution and the solution that the proposed strategy will suggest, (a) Fill the sack with lowest weight items first satisfying the capacity con- straint of the bag. When there is a tie, choose the ite with highest alue (b) Fill the sack with highest value items first satisfying the capacity con- straint of the bag. When there is a tie, choose the item with lowest weight. (c) Fill the sack with the highest value-to-weight ratioitems first satisfying the capacity constraint of the bag. When there is a tie, choose the item with highest value. 2. The input consists of n skiers with heights p P and n skies with heights s1 Sn The problem is to assign each skier a ski to minimize the AVERAGE DIFFERENCE between the height of a skier and his/her assigned ski. That is, if the skier i is given the ski a, then you want to minimize: Write a greedy algorithm to solve the
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
