Richard Anderson Lecture 11 Minimum Spanning Trees

Slides:



Advertisements
Similar presentations
O(N 1.5 ) divide-and-conquer technique for Minimum Spanning Tree problem Step 1: Divide the graph into  N sub-graph by clustering. Step 2: Solve each.
Advertisements

Great Theoretical Ideas in Computer Science for Some.
MA/CSSE 473 Day 13 Divide and Conquer Closest Points Convex Hull Answer Quiz Question 1.
Algorithms Recurrences Continued The Master Method.
Great Theoretical Ideas in Computer Science.
CSE 421 Algorithms Richard Anderson Dijkstra’s algorithm.
Lecture 28 CSE 331 Nov 9, Flu and HW 6 Graded HW 6 at the END of the lecture If you have the flu, please stay home Contact me BEFORE you miss a.
CSE 421 Algorithms Richard Anderson Lecture 12 Recurrences.
Data Structures, Spring 2004 © L. Joskowicz 1 Data Structures – LECTURE 3 Recurrence equations Formulating recurrence equations Solving recurrence equations.
Data Structures, Spring 2006 © L. Joskowicz 1 Data Structures – LECTURE 3 Recurrence equations Formulating recurrence equations Solving recurrence equations.
CSE 421 Algorithms Richard Anderson Lecture 10 Minimum Spanning Trees.
CSE 421 Algorithms Richard Anderson Lecture 13 Divide and Conquer.
CSE 421 Algorithms Richard Anderson Lecture 11 Recurrences.
Lecture 30 CSE 331 Nov 10, Online Office Hours
Lecture 27 CSE 331 Nov 6, Homework related stuff Solutions to HW 7 and HW 8 at the END of the lecture Turn in HW 7.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
Lecture 19 Greedy Algorithms Minimum Spanning Tree Problem.
CSE 421 Algorithms Lecture 15 Closest Pair, Multiplication.
Foundations II: Data Structures and Algorithms
CSEP 521 Applied Algorithms Richard Anderson Winter 2013 Lecture 4.
CSCI 256 Data Structures and Algorithm Analysis Lecture 10 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 11.
CSE 421 Algorithms Richard Anderson Lecture 13 Recurrences, Part 2.
Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design.
Kruskal’s Algorithm for Computing MSTs Section 9.2.
Introduction to Algorithms Prof. Charles E. Leiserson
Greedy Algorithms – Chapter 5
Divide-and-Conquer 6/30/2018 9:16 AM
Algorithm Design & Analysis
Lecture 26 CSE 331 Nov 2, 2016.
Greedy Algorithms (Chap. 16)
Great Theoretical Ideas in Computer Science
Greedy Algorithms / Minimum Spanning Tree Yin Tat Lee
Chapter 4: Divide and Conquer
Autumn 2016 Lecture 11 Minimum Spanning Trees (Part II)
Autumn 2015 Lecture 11 Minimum Spanning Trees (Part II)
Punya Biswas Lecture 15 Closest Pair, Multiplication
Richard Anderson Lecture 13 Recurrences and Divide and Conquer
Lecture 26 CSE 331 Nov 1, 2017.
Divide-and-Conquer 7 2  9 4   2   4   7
Richard Anderson Lecture 11 Recurrences
Richard Anderson Lecture 13 Divide and Conquer
Autumn 2015 Lecture 10 Minimum Spanning Trees
Lecture 11 Overview Self-Reducibility.
Richard Anderson Lecture 12 Recurrences and Divide and Conquer
Richard Anderson Lecture 13 Recurrences, Part 2
Lecture 27 CSE 331 Oct 31, 2014.
Lecture 25 CSE 331 Oct 28, 2013.
Lecture 28 CSE 331 Nov 7, 2012.
Divide and Conquer (Merge Sort)
Lecture 27 CSE 331 Nov 2, 2010.
Richard Anderson Lecture 10 Minimum Spanning Trees
Divide-and-Conquer 7 2  9 4   2   4   7
Autumn 2016 Lecture 10 Minimum Spanning Trees
Lecture 15, Winter 2019 Closest Pair, Multiplication
Richard Anderson Lecture 14 Divide and Conquer
Minimum Spanning Trees (MSTs)
Winter 2019 Lecture 11 Minimum Spanning Trees (Part II)
Richard Anderson Lecture 13, Winter 2019 Recurrences, Part 2
Richard Anderson Lecture 14, Winter 2019 Divide and Conquer
Winter 2019 Lecture 10 Minimum Spanning Trees
Richard Anderson Lecture 14 Divide and Conquer
Divide-and-Conquer 7 2  9 4   2   4   7
CSE 332: Minimum Spanning Trees
Lecture 15 Closest Pair, Multiplication
Richard Anderson Lecture 12, Winter 2019 Recurrences
Richard Anderson Lecture 12 Recurrences
Richard Anderson Lecture 13 Divide and Conquer
Lecture 27 CSE 331 Nov 1, 2013.
Autumn 2019 Lecture 11 Minimum Spanning Trees (Part II)
Presentation transcript:

Richard Anderson Lecture 11 Minimum Spanning Trees CSE 421 Algorithms Richard Anderson Lecture 11 Minimum Spanning Trees

Announcements Monday – Class in EE1 003 (no tablets)

Foreign Exchange Arbitrage USD 1.2 1.2 USD EUR CAD ------ 0.8 1.2 1.6 0.6 ----- EUR CAD 0.6 USD 0.8 0.8 EUR CAD 1.6

Minimum Spanning Tree 15 t a 6 9 14 3 4 e 10 13 c s 11 20 5 17 2 7 g b 8 f 22 u 12 1 16 v Temporary Assumption: Edge costs distinct

Why do the greedy algorithms work? For simplicity, assume all edge costs are distinct Let S be a subset of V, and suppose e = (u, v) be the minimum cost edge of E, with u in S and v in V-S e is in every minimum spanning tree Or equivalently, if e is not in T, then T is not a minimum spanning tree e S V - S

Proof Suppose T is a spanning tree that does not contain e Add e to T, this creates a cycle The cycle must have some edge e1 = (u1, v1) with u1 in S and v1 in V-S T1 = T – {e1} + {e} is a spanning tree with lower cost Hence, T is not a minimum spanning tree S V - S e Why is e lower cost than e1?

Optimality Proofs Prim’s Algorithm computes a MST Kruskal’s Algorithm computes a MST

Reverse-Delete Algorithm Lemma: The most expensive edge on a cycle is never in a minimum spanning tree

Dealing with the distinct cost assumption Force the edge weights to be distinct Add small quantities to the weights Give a tie breaking rule for equal weight edges

MST Fun Facts The minimum spanning tree is determined only by the order of the edges – not by their magnitude Finding a maximum spanning tree is just like finding a minimum spanning tree

Divide and Conquer Array Mergesort(Array a){ n = a.Length; if (n <= 1) return a; b = Mergesort(a[0..n/2]); c = Mergesort(a[n/2+1 .. n-1]); return Merge(b, c);

Algorithm Analysis Cost of Merge Cost of Mergesort

T(n) = 2T(n/2) + cn; T(1) = c;

Recurrence Analysis Solution methods Unrolling recurrence Guess and verify Plugging in to a “Master Theorem”

A better mergesort (?) Divide into 3 subarrays and recursively sort Apply 3-way merge

T(n) = aT(n/b) + f(n)

T(n) = T(n/2) + cn

T(n) = 4T(n/2) + cn

T(n) = 2T(n/2) + n2

T(n) = 2T(n/2) + n1/2

Recurrences Three basic behaviors Dominated by initial case Dominated by base case All cases equal – we care about the depth