Consider a modification to the activity-selection problem in which each activity ai has, in...
Consider the following variation on the Activity Selection Problem.You have a resource that may be used for activities 24 hours a day,ever day.Activities repeat that may be used for activities repeat on a daily basis. As in the original problem, each activity has a start time and as end time.If an activity is selected, it will exclusively use the resource during the duration between the start and end time(i.e., no other activity may be scheduled during this time). Note that...
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...
problem 2 can use Det-Selection(A, p, q, r) as a sub-routine (i.e, you don't need to write its pseudo-code). To sort an array A, you will then call Det-QuickSort(A, 1, n). You also need to provide the worst case time complexity analysis of your algorithm. 2. (20 points) Given a set of n distinct numbers, we wish to find the k largest in sorted order using a comparison-based algorithm. Give an algorithm that implements each of the following methods, and...