Question

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

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

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
Suppose n activities apply for using a common resource. Activity ai (1 ≤ i ≤ n)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Let A be an array containing n numbers (positive and negative). Develop a divide and conquer algo...

    need help in this algorithm question Let A be an array containing n numbers (positive and negative). Develop a divide and conquer algorithm that finds the two indices 1 sisjsn such that A[k] (the sum of the elements from i to j) is maximized. For example, in the array A [10,-5,-6,5, 7,-2,4, -11], the sub-array A[4:6] has the sum 5+ 7-2+4-14 and no other sub-array contains elements that sum to a value greater than 14, so for this input the...

  • 7. Given a set of n activities with start time and finish time F; of an...

    7. Given a set of n activities with start time and finish time F; of an i activity. Find the maximum size set of mutually compatible activities. Implement following string matching algorithms and analyze time complexities: 8. a) Naïve method b) Rabin karp Algorithm c) Finite state Automaton algorithm 9. A hash table is a data structure used to implement an associative array, al structure that can map keys to values. Implement Hashing using Linear and Quadratic Probing.

  • 6. Consider the following basic problem. You're given an array A consisting of n integers A[1],...

    6. Consider the following basic problem. You're given an array A consisting of n integers A[1], A[2], , Aln]. You'd like to output a two-dimensional n-by-n array B in which B[i, j] (for i <j) contains the sum of array entries Ali] through Aj]-that is, the sum A[i] Ai 1]+ .. +Alj]. (The value of array entry B[i. Λ is left unspecified whenever i >j, so it doesn't matter what is output for these values.) Here's a simple algorithm to...

  • Instead of always selecting the first activity to finish, select the last activity to start that...

    Instead of always selecting the first activity to finish, select the last activity to start that is compatible with all previously selected activities. Accomplish this by implementing a greedy algorithm in either Python or C++. This is similar to a first-to-start algorithm, but in reverse; the goal is to select the start-times that appear later. See the example below and ensure that your output matches the example below. Include a verbal description of your algorithm, pseudocode and analysis of the...

  • (13 pts) Given an array AlI,2,. .. ,n] integers, design and analyze an efficient Divide-and-Conqu...

    (13 pts) Given an array AlI,2,. .. ,n] integers, design and analyze an efficient Divide-and-Conquer algorithm to find some i and j, where j > 1, such that A[j]-Ali] is maximized. For example, given A 6, 1,3,8,4,5, 12,6], the maximum value of AL] - Ali] for j > i is 12-1 11 where j -7 and i 2. Give the underlying recurrence relation for your algorithm and analyze its running time. You should carefully state all details of your algorithm:...

  • 3.2 L5 To solve the problem: problem decomposition: we would like to find the requests one...

    3.2 L5 To solve the problem: problem decomposition: we would like to find the requests one by one. Idea 1: select the request with the earliest start time from the requests compatible with the selected ones. Greedy: earliest start time. Candidates: requests compatible with the selected ones. It does not work in the example (a) below: Idea 2: select the request with the smallest duration from the requests compatible with the selected ones. Greedy: smallest duration. Candidates: requests compatible with...

  • Prove using mathematical induction that for every positive integer n, = 1/i(i+1) = n/n+1. 2) Suppose...

    Prove using mathematical induction that for every positive integer n, = 1/i(i+1) = n/n+1. 2) Suppose r is a real number other than 1. Prove using mathematical induction that for every nonnegative integer n, = 1-r^n+1/1-r. 3) Prove using mathematical induction that for every nonnegative integer n, 1 + i+i! = (n+1)!. 4) Prove using mathematical induction that for every integer n>4, n!>2^n. 5) Prove using mathematical induction that for every positive integer n, 7 + 5 + 3 +.......

  • Activity Selection Last-to-Start | C++ Implementation Develop a program with a greedy algorithm that instead of always...

    Activity Selection Last-to-Start | C++ Implementation Develop a program with a greedy algorithm that instead of always selecting the first activity to finish, instead selects the last activity to start that is compatible with all previously selected activities. The program should read input from a file named “act.txt”. The file contains lists of activity sets with number of activities in the set in the first line followed by lines containing the activity number, start time & finish time. Example act.txt:...

  • The project described in the table uses the same resource for activities A, B, C, and...

    The project described in the table uses the same resource for activities A, B, C, and D. Which activity gets first use of this resource if we assign the resource based on the activity with the shortest duration? Activity Duration Predecessor WBS ID W 4 -- 12 A 3 W 16 B 4 W 15 C 5 W 13 D 6 W 14 E 1 B 17 Z 7 A, E, C, D 18 Activity A Activity B Activity C...

  • Construct an Activity-on-branch network from the precedence relationships of activities shown Activity Predecessors Duration 6 7...

    Construct an Activity-on-branch network from the precedence relationships of activities shown Activity Predecessors Duration 6 7 A A A B с D E F 1 14 5 8 9 3 5 3 B C D C, D D H F E, J F GI G, I L, N H I J K L M 12 6

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT