CSE331 Lecture 25

# CSE331 Lecture 25 - Kruskal’s Algorithm Joseph B. Kruskal...

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

Lecture 25 CSE 331 Oct 28, 2011

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

View Full Document
HW 6 due today Q1, Q2 and Q3 in separate piles I will not take any HW after 1:15pm
Other HW related stuff HW 5 will be available for pickup from Monday Solutions to HW 6 at the end of the lecture HW 7 has been posted (link on the blog)

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

View Full Document
Dijkstra’s shortest path algorithm Input: Directed G=(V,E) , l e ≥ 0 , s in V S = {s} , d(s) =0 While there is a v not in S with (u,v) in E , u in S Pick w that minimizes d’(w) Add w to S d(w) = d’(w) At most n iterations At most n iterations O(m) time O(m) time O(mn) time bound is trivial O(m log n) time implementation is possible d’(v) = min e=(u,v) in E , u in S d(u)+l e
Reading Assignment Sec 4.4 of [KT]

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

View Full Document
Building a fiber network Lay down fibers to connect n locations All n locations should be connected Laying down a fiber costs money What is the cheapest way to lay down the fibers?
Today’s agenda Minimum Spanning Tree (MST) Problem Greedy algorithm(s) for MST problem

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

View Full Document
HW 6 due today Q1, Q2 and Q3 in separate piles I will not take any HW after 1:15pm

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: Kruskal’s Algorithm Joseph B. Kruskal Input: G=(V,E) , c e > 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 Prim’s algorithm Robert Prim Similar to Dijkstra’s algorithm Input: G=(V,E) , c e > 0 for every e in E 2 1 3 51 50 0.5 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 2 1 50 0.5 Reverse-Delete Algorithm Input: G=(V,E) , c e > 0 for every e in E T = E Sort edges in decreasing order of their cost Consider edges in sorted order If an edge can be removed T without disconnecting T then remove it 2 1 3 51 50 0.5 2 1 3 51 50 0.5 (Old) History of MST algorithms 1920: Otakar Borůvka 1930: Vojtěch Jarník 1956: Kruskal 1957: Prim 1959: Dijkstra Same algo! Same algo!...
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 / 12

CSE331 Lecture 25 - Kruskal’s Algorithm Joseph B. Kruskal...

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

View Full Document
Ask a homework question - tutors are online