Question: 2. (20 points) Consider the following problem. The input consists of n skiers with heights h, ..., hn, and n skies with heights si, ...,

 2. (20 points) Consider the following problem. The input consists of

2. (20 points) Consider the following problem. The input consists of n skiers with heights h, ..., hn, and n skies with heights si, ..., Sn. The problem is to assign each skier a pair of skies to minimize the average difference between the height of a skier and his/her assigned skies. That is, if the ith skier is given the a(i)th ski, then you want to minimize the absolute value of hi- Sali. But minimize the average of the sum over all n pairs: 1L . it hi-Stil Greedy algorithm #1. Find the skier and skies whose height difference is minimized. Assign this skier these skies. Repeat the process until every skier has skies. a. b. Greedy algorithm #2. Give the shortest skier the shortest skies, give the second shortest skier the second shortest skies, give the third shortest skier the third shortest skies, etc. One of the above greedy algorithms is correct and one is incorrect. Prove that one algorithm is incorrect. Explain why the other is correct

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!