CSE331 Lecture 19

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

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

View Full Document Right Arrow Icon
Lecture 19 CSE 331 Oct 14, 2011
Background image of page 1

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

View Full DocumentRight Arrow Icon
Announcements Graded HW 4 next Th onwards HW 5 has been posted
Background image of page 2
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
Sign up for scribe/blog post
Background image of page 4
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
Background image of page 5

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

View Full DocumentRight Arrow Icon
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
Background image of page 6
Greedy “stays ahead” Greed y Greed y OP T OP T
Background image of page 7

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

View Full DocumentRight Arrow Icon
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 ) ?
Background image of page 8
A formal claim For every r ≤ k , f(i r ) ≤ f(j r ) The greedy algorithm outputs an optimal A
Background image of page 9

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

View Full DocumentRight Arrow Icon
Background image of page 10
Background image of page 11

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

View Full DocumentRight Arrow Icon
Background image of page 12
Background image of page 13
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! Todays 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: Ill 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

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.

Page1 / 13

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

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online