Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 23 CSE 331 Oct 24, 2010. Temp letter grades assigned See the blog post for more details.

Similar presentations


Presentation on theme: "Lecture 23 CSE 331 Oct 24, 2010. Temp letter grades assigned See the blog post for more details."— Presentation transcript:

1 Lecture 23 CSE 331 Oct 24, 2010

2 Temp letter grades assigned See the blog post for more details

3 Emails have been sent out If you got an email, please schedule your appointment with me ASAP

4 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

5 An observation In a valid schedule sorted by finish time is the same as sorted by start time 331 HW Exam study Party!

6 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

7 Today’s agenda Better run time analysis (on slides) A more realistic scheduling problem for end of semester blues

8 Questions?

9 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

10 Algorithm implementation Go through the intervals in order of their finish time 1 1 2 2 3 3 4 4 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

11 Reading Assignment Sec 4.1of [KT]

12 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

13 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

14 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

15 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

16 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


Download ppt "Lecture 23 CSE 331 Oct 24, 2010. Temp letter grades assigned See the blog post for more details."

Similar presentations


Ads by Google