hw4 - CSCI 4041: Algorithms and Data Structures (Fall09)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
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 finish 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 find a maximum-size set of mutually compatible events. (a) (25 points) Assuming the activities have been sorted based on the finish times, give a bottom-up dynamic-programming algorithm for solving the activity-selection problem using the recurrence on c [ i,j ] , the number of activities in a maximum-size 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
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.
Ask a homework question - tutors are online