lecture 26 - university at buffalo

14
Lecture 26 CSE 331 Nov 2, 2018

Upload: others

Post on 29-May-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 26 - University at Buffalo

Lecture 26

CSE 331Nov 2, 2018

Page 2: Lecture 26 - University at Buffalo

Have fun at UB Hacking!

Page 3: Lecture 26 - University at Buffalo

As will your TAs….

Page 4: Lecture 26 - University at Buffalo

HW 7 is out

Once you understand what Q2 is asking, it’ll be easy

Page 5: Lecture 26 - University at Buffalo

HW 6 Solutions

At the END of the lecture

Page 6: Lecture 26 - University at Buffalo

Video due Monday

Page 7: Lecture 26 - University at Buffalo

Peer evaluation due Wed 11:59pm

Page 8: Lecture 26 - University at Buffalo

Kruskal’s Algorithm

Joseph B. Kruskal

Input: G=(V,E), ce> 0 for every e in E

T = Ø

Sort edges in increasing order of their cost

Consider edges in sorted order

If an edge can be added to T without adding a cycle then add it to T

Page 9: Lecture 26 - University at Buffalo

Prim’s algorithmSimilar to Dijkstra�s algorithm

Input: G=(V,E), ce> 0 for every e in E

S = {s}, T = Ø

While S is not the same as V

Among edges e= (u,w) with u in S and w not in S, pick one with minimum cost

Add w to S, e to T

Page 10: Lecture 26 - University at Buffalo

(Old) History of MST algorithms

1920: Otakar Borůvka 1930: Vojtěch Jarník

1956: Kruskal

1957: Prim 1959: Dijkstra

Same algo!

Page 11: Lecture 26 - University at Buffalo

Some modern Algo Researchers

Page 12: Lecture 26 - University at Buffalo

Can you guess the common link?

Page 13: Lecture 26 - University at Buffalo

Cut Property Lemma for MSTs

S V \ S

Cheapest crossing edge is in all MSTs

Condition: S and V\S are non-empty

Assumption: All edge costs are distinct

Page 14: Lecture 26 - University at Buffalo

Today’s agenda

Prove correctness of Prim’s+Kruskal�s algorithm using Cut Property Lemma

Prove Cut Property Lemma