Question: 1 Greedy Activity Selection ( 1 5 pt . ) Activity Selection is a classic algorithms problem. It works as follows: you are given a

1 Greedy Activity Selection (15 pt.)
Activity Selection is a classic algorithms problem. It works as follows: you are given a schedule with n activities, each of which has a start and finish time. You must select a subset of the greatest possible size, subject to the constraint that none of the activities within overlap. Below is an example schedule.
Time
Two valid solutions to this schedule are {a1, a2, a6, a7}, and {a1, a3, a6, a7}. Two invalid solutions are {a1, a2, a6}(we only include three activities when we could include four) and {a1, a2, a6, a8}(two of the activities overlap).
Consider the following greedy algorithm for activity selection. The idea is that at each step, we greedily add a valid activity with the fewest conflicts with other valid activities. (An activity is valid if it doesnt conflict with an already selected activity).
The algorithm (breaking ties arbitrarily) could choose a1, then a6, then a7, then a2.
Is this algorithm correct?
[We are expecting: Either a short English explanation for why this algorithm always succeeds, or a counterexample to show that it doesnt.]

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 Programming Questions!