Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 22 CSE 331 Oct 15, 2014.

Similar presentations


Presentation on theme: "Lecture 22 CSE 331 Oct 15, 2014."— Presentation transcript:

1 Lecture 22 CSE 331 Oct 15, 2014

2 Graded Quiz 1 Will hand them out at the END of the lecture

3 Online OH

4 Two definitions for schedules
Idle time Max “gap” between two consecutively scheduled tasks Idle time =0 Idle time =1 Inversion (i,j) is an inversion if i is scheduled before j but di > dj i j f=1 For every i in 1..n do Schedule job i from si=f to fi=f+ti f=f+ti i j 0 idle time and 0 inversions for greedy schedule

5 Proof structure Any two schedules with 0 idle time and 0 inversions have the same max lateness Greedy schedule has 0 idle time and 0 inversions There is an optimal schedule with 0 idle time and 0 inversions

6 Today’s agenda “Exchange” argument to convert an optimal solution into a 0 inversion one

7 Rest of Today Shortest Path Problem

8 Reading Assignment Sec 2.5 of [KT]

9 Shortest Path problem s 100 Input: Directed graph G=(V,E) w
15 5 s u w 100 Input: Directed graph G=(V,E) Edge lengths, le for e in E “start” vertex s in V 15 5 s u w 5 s u Output: All shortest paths from s to all nodes in V

10 Naïve Algorithm Ω(n!) time

11 Dijkstra’s shortest path algorithm
E. W. Dijkstra ( )

12 Dijkstra’s shortest path algorithm
1 d’(w) = min e=(u,w) in E, u in R d(u)+le 1 2 4 3 y 4 3 u d(s) = 0 d(u) = 1 s x 2 4 d(w) = 2 d(x) = 2 d(y) = 3 d(z) = 4 w z 5 4 2 s w Input: Directed G=(V,E), le ≥ 0, s in V u R = {s}, d(s) =0 Shortest paths x While there is a x not in R with (u,x) in E, u in R z y Pick w that minimizes d’(w) Add w to R d(w) = d’(w)

13 Couple of remarks The Dijkstra’s algo does not explicitly compute the shortest paths Can maintain “shortest path tree” separately Dijkstra’s algorithm does not work with negative weights Left as an exercise


Download ppt "Lecture 22 CSE 331 Oct 15, 2014."

Similar presentations


Ads by Google