This preview shows page 1. Sign up to view the full content.
CSCI 4041: Algorithms and Data Structures
(Fall’09)
Homework 4, Due 11/24/09
Answer all of the following questions, and always explain your answer. Good Luck!
1. (50 points) Consider the activity selection problem with a set
S
=
{
a
1
,...,a
n
}
of
n
proposed activi
ties that wish to use a resource, e.g., different courses planning to use a classroom. Each activity has
a known start time
s
i
and a ﬁnish time
f
i
where
s
i
≤
f
i
. Activities
a
i
and
a
j
are compatible if the
intervals
[
s
i
,f
i
)
and
[
s
j
,f
j
)
do not overlap. The activity selection problem is to ﬁnd a maximumsize
set of mutually compatible events.
(a) (25 points) Assuming the activities have been sorted based on the ﬁnish times, give a bottomup
dynamicprogramming algorithm for solving the activityselection problem using the recurrence
on
c
[
i,j
]
, the number of activities in a maximumsize subset of mutually compatible activities
in
S
i,j
. What is the complexity of the dynamic programming algorithm?
(b) (25 points) Give a memoized version of the dynamic programming algorithm for the activity
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '08
 karypis
 Algorithms, Data Structures

Click to edit the document details