Give a dynamic-programming algorithm for the activity-selection problem, based on recurrence (16.2). Have your algorithm compute the

Question:

Give a dynamic-programming algorithm for the activity-selection problem, based on recurrence (16.2). Have your algorithm compute the sizes c[I, j] as defined above and also produce the maximum-size subset of mutually compatible activities. Assume that the inputs have been sorted as in equation (16.1). Compare the running time of your solution to the running time of GREEDY-ACTIVITY-SELECTOR.

(16.2)

if Sij = Ø , max {c[i,k]+ c[k, j]+ 1} _if Sij + Ø . c[i, j]= ak ES¡J

(16.1)

ш ши a1 RECURSIVE-ACTIVITY-SELECTOR(S, f, 0, 11) Ш ш 2 3 5 RECURSIVE-ACTIVvrTY-SELECTOR(S, f, 1, 11) a1 3 0 6 a1 a4

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Introduction to Algorithms

ISBN: 978-0262033848

3rd edition

Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest

Question Posted: