Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The activity selection problem is to find a subset of n compatible activities su

ID: 643145 • Letter: T

Question

The activity selection problem is to find a subset of n compatible activities such that the size of the subset is maximized. Now, we change the activity selection problem to the following: Find a subset of compatible activities such that the summation of the activity durations is maximized.

(a) Can you think of a dynamic programming approach to solve this modied problem? You must identify the optimal structures and give the recurrence equation.

(b) Based on the recurrence, write the pseudo code of the algorithm.

(c) Mr.Xavier comes up with a greedy approach:

Step 1. Let S be the set of all activities;

Step 2. Select a subscript m from S such that the duration of a of m is longest;

Step 3. Remove all events not compatible with a subscript m from S;

Step 4.Repeat Step 2-3 until S is empty;

Step 5. Return all selected activities as the solution.

Will Mr.Xavier's greedy algorithm guarantee to always return an optimal solution? Please justify your answer.

Explanation / Answer

yes because he took all nesessary precautions and its rather a practival one

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote