Question: Suppose n activities apply for using a common resource. Activity ai (1 i n) has a starting time S[i] and a finish time F[i] such

Suppose n activities apply for using a common resource. Activity ai (1 i n)

has a starting time S[i] and a finish time F[i] such that 0 < S[i] < F[i]. Two activities ai and aj (1

i, j n) are compatible if intervals [S[i], F[i]) and [S[j], F[j]) do not overlap. We assume the

activities have been sorted such that S [1] S [2] S[n].

(a) Design an O(n2) dynamic programming algorithm to find a set of compatible activities such

that the total amount of time the resource is used by these compatible activities is

maximized. You need to define the sub-problems, establish inductive formula, and show

the initial conditions. Pseudo code is not required.

(b) Apply your algorithm to the following set of activities

i 1 2 3 4 5 6 7 8 9 10 11

S[i] 2 3 5 6 7 9 10 12 13 14 16

F[i] 6 5 7 10 8 13 16 14 14 18 20

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!