Lecture 16 · 2020-04-13 · Lecture 16 CSE 331 Mar2, 2020. Quiz 1 on Friday. Midterms next week:...

8
Lecture 16 CSE 331 Mar 2, 2020

Transcript of Lecture 16 · 2020-04-13 · Lecture 16 CSE 331 Mar2, 2020. Quiz 1 on Friday. Midterms next week:...

Page 1: Lecture 16 · 2020-04-13 · Lecture 16 CSE 331 Mar2, 2020. Quiz 1 on Friday. Midterms next week: Wed & Fri Will make a detailed post on Piazza this week. Teams finalized; video is

Lecture 16

CSE 331Mar 2, 2020

Page 2: Lecture 16 · 2020-04-13 · Lecture 16 CSE 331 Mar2, 2020. Quiz 1 on Friday. Midterms next week: Wed & Fri Will make a detailed post on Piazza this week. Teams finalized; video is

Quiz 1 on Friday

Page 3: Lecture 16 · 2020-04-13 · Lecture 16 CSE 331 Mar2, 2020. Quiz 1 on Friday. Midterms next week: Wed & Fri Will make a detailed post on Piazza this week. Teams finalized; video is

Midterms next week: Wed & Fri

Will make a detailed post on Piazza this week.

Page 4: Lecture 16 · 2020-04-13 · Lecture 16 CSE 331 Mar2, 2020. Quiz 1 on Friday. Midterms next week: Wed & Fri Will make a detailed post on Piazza this week. Teams finalized; video is

Teams finalized;video is due April 10, 11am

Page 5: Lecture 16 · 2020-04-13 · Lecture 16 CSE 331 Mar2, 2020. Quiz 1 on Friday. Midterms next week: Wed & Fri Will make a detailed post on Piazza this week. Teams finalized; video is

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

Page 6: Lecture 16 · 2020-04-13 · Lecture 16 CSE 331 Mar2, 2020. Quiz 1 on Friday. Midterms next week: Wed & Fri Will make a detailed post on Piazza this week. Teams finalized; video is

Analyzing the algorithm

R: set of requests

Set S to be the empty set

While R is not empty

Choose i in R with the earliest finish time

Add i to S

Remove all requests that conflict with i from R

Return S* = S

S* has no conflicts

S* is an optimal solution

Page 7: Lecture 16 · 2020-04-13 · Lecture 16 CSE 331 Mar2, 2020. Quiz 1 on Friday. Midterms next week: Wed & Fri Will make a detailed post on Piazza this week. Teams finalized; video is

Greedy �stays ahead�

Greedy

OPT

Page 8: Lecture 16 · 2020-04-13 · Lecture 16 CSE 331 Mar2, 2020. Quiz 1 on Friday. Midterms next week: Wed & Fri Will make a detailed post on Piazza this week. Teams finalized; video is

Today’s agenda

Analyze run-time of the greedy algorithm

Prove the correctness