{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CSE331 Lecture 19

CSE331 Lecture 19 - The greedy algorithm outputs an optimal...

This preview shows pages 1–13. Sign up to view the full content.

Lecture 19 CSE 331 Oct 14, 2011

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Announcements Graded HW 4 next Th onwards HW 5 has been posted
Mid Term stuff Mid term post up on the blog Read it before asking for regrade requests A temp grade assigned by next week I’ll ask some of you to meet me in person Graded mid term at the end of the lecture

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Interval Scheduling Problem Input: n intervals [ s(i), f(i) ) for 1≤ i ≤ n Output: A schedule S of the n intervals No two intervals in S conflict |S| is maximized

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Analyzing the algorithm 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* has no conflicts A* has no conflicts A* is an optimal solution A* is an optimal solution
Greedy “stays ahead” Greed y Greed y OP T OP T

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Greedy “stays ahead” A* = i 1 ,…, i k O = j 1 ,…, j m What do we need to prove? What do we need to prove? k = m k = m What can you say about f(i 1 ) and f(j 1 )? What can you say about f(i 1 ) and f(j 1 ) ?
A formal claim For every r ≤ k , f(i r ) ≤ f(j

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

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

Unformatted text preview: The greedy algorithm outputs an optimal A A* = i 1 ,…, i k O = j 1 ,…, j m Proof by contradiction: A is not optimal m > k i k i k j k j k j k+1 j k+1 No conflict! After i k , R was non-empty! After i k , R was non-empty! Today’s agenda Analyze run-time of the greedy algorithm Prove the claim The mid-term mixup Proctors allowed early arrivals to read the exam questions Unfair to students who did not come early Proposal: I’ll add 5 points at the end of the semester if it bumps up a letter grade (but not from A-to A) Email me if you have comments The mid-term story Average: 50.2 Median: 51 Remember, mid term score gets dropped if you better on the final Time pressure issues Proof of claim For every r ≤ k , f(i r ) ≤ f(j r ) i r-1 i r-1 j r-1 j r-1 j r j r By induction on r Why is r=1 OK? Why is r=1 OK? Assume true up to r-1 i r i r ? Greedy can always pick j r Greedy can always pick j r...
View Full Document

{[ snackBarMessage ]}