Question: 2. Greedy Skis (5 points + 5 extra credit points) Assume there are n people with heights pi,..., pn and there are n skis with

 2. Greedy Skis (5 points + 5 extra credit points) Assume

2. Greedy Skis (5 points + 5 extra credit points) Assume there are n people with heights pi,..., pn and there are n skis with heights s1,... , Sn. The task is to assign each person a ski in such a way that the average height difference between the person and their assigned ski is minimized I.e., the task is to minimize Tn where f is the assignment function Consider the following two greedy algorithms (a) Find the person and the ski with the minimum height difference. Assign this ski to this person. Repeat until every person has a ski. (b) Sort the persons by height and sort the skis by height. Give the shortest person the shortest ski, and repeat. One of the algorithms above is correct, the other is incorrect. Find the one that is incorrect and disprove it with a counterexample (i.e., an example input where the greedy solution differs from the optimal solution For the correct algorithm, vou can get if you can provide a (partial) proof of its correctness. up to five extra credit points

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!