Lecture 23 CSE 331 Oct 24, 2010
Temp letter grades assigned See the blog post for more details
s have been sent out If you got an , please schedule your appointment with me ASAP
Algorithm for Interval Scheduling R: set of requests Set A to be the empty set While R is not empty Choose i in R with the earliest finish time Add i to A Remove all requests that conflict with i from R Return A A is optimal
An observation In a valid schedule sorted by finish time is the same as sorted by start time 331 HW Exam study Party!
A naïve run time analysis Set A to be the empty set While R is not empty Choose i in R with the earliest finish time Add i to A Remove all requests that conflict with i from R Return A O(n) time At most n iterations O(n 2 ) time
Today’s agenda Better run time analysis (on slides) A more realistic scheduling problem for end of semester blues
Questions?
Run time analysis Set A to be the empty set While R is not empty Choose i in R with the earliest finish time Add i to A Remove all requests that conflict with i from R Return A O(n log n) time sort intervals such that f(i) ≤ f(i+1) O(n) time build array s[1..n] s.t. s[i] = start time for i Do the removal on the fly
Algorithm implementation Go through the intervals in order of their finish time How can you tell in O(1) time if any of 2,3 or 4 conflict with 1? Check if s[i] < f(1) In general, if jth interval is the last one chosen Pick smallest i>j such that s[i] ≥ f(j) O(n log n) run time
Reading Assignment Sec 4.1of [KT]
The “real” end of Semester blues MondayTuesdayWednesdayThursdayFriday Project 331 HW Exam study Party! Write up a term paper There are deadlines and durations of tasks
The “real” end of Semester blues MondayTuesdayWednesdayThursdayFriday Project 331 HW Exam study Party! Write up a term paper There are deadlines and durations of tasks
The algorithmic task MondayTuesdayWednesdayThursdayFriday Project 331 HW Exam study Party! Write up a term paper YOU decide when to start each task You have to do ALL the tasks
Scheduling to minimize lateness MondayTuesdayWednesdayThursdayFriday Project 331 HW Exam study Party! Write up a term paper All the tasks have to be scheduled GOAL: minimize maximum lateness All the tasks have to be scheduled GOAL: minimize maximum lateness
One possible schedule MondayTuesdayWednesdayThursdayFriday 331 HW Exam study Party! Write up a term paper All the tasks have to be scheduled GOAL: minimize maximum lateness All the tasks have to be scheduled GOAL: minimize maximum lateness Lateness = 0 Lateness = 2