CSE331 Lecture 20

# CSE331 Lecture 20 - Lecture 20 CSE 331 Temp letter grades...

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

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Lecture 20 CSE 331 Oct 17, 2011 Temp letter grades assigned See the blog post for more details A feedback… Time pressure on mid-term favors “quick thinkers” Tested different skills than those on HWs Mid-term has more weight than the homeworks Need another scribe for today Any volunteer? 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 A* is optimal Run time analysis 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 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 Do the removal on the fly Algorithm implementation Go through the intervals in order of their finish time 3 2 1 4 In general, if jth interval is the last one chosen Pick smallest i>j such that s[i] ≥ f(j) How can you tell Check if ts[i] <iff(1) in O(1) ime any of 2,3 or 4 conflict with 1? O(n log n) run time The final algo 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 Add 1 to A and set f = f(1) For i = 2 .. n If s[i] ≥ f Add i to A Set f = f(i) Return A* = A Reading Assignment Sec 4.1of [KT] Questions? The “real” end of Semester blues There are deadlines and durations of tasks Write up a term paper Party! Exam study 331 HW Project Monday Tuesday Wednesday Thursday Friday The “real” end of Semester blues There are deadlines and durations of tasks Write up a term paper Exam study Party! 331 HW Project Monday Tuesday Wednesday Thursday Friday The algorithmic task YOU decide when to start each task Write up a term paper You have to do ALL the tasks Exam study Party! 331 HW Project Monday Tuesday Wednesday Thursday Friday Scheduling to minimize lateness All the tasks have to be scheduled GOAL: minimize maximum lateness Write up a term paper Exam study Party! 331 HW Project Monday Tuesday Wednesday Thursday Friday One possible schedule All the tasks have to be scheduled GOAL: minimize maximum lateness Lateness = 0 331 HW Monday Tuesday Lateness = 2 Party! Exam study Wednesday Thursday Write up a term pa Friday ...
View Full Document

## This note was uploaded on 12/11/2011 for the course CSE 331 taught by Professor Rudra during the Fall '11 term at SUNY Buffalo.

Ask a homework question - tutors are online