This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 473: Fundamental Algorithms, Spring 2011 HW 6 Question 1 is due by Sunday, 23:59:59, March 13 Questions 24 are due by Monday, 23:59:59, March 14 This homework contains four problems. Read the instructions for submitting homework on the course webpage . Collaboration Policy: For this homework, Problems 2–4 can be worked in groups of up to three students. Problem 1 should be answered in Compass as part of the assessment HW6Online and should be done individually. Note: You do not have to prove the correctness of your algorithms. In this solution, we give some key ideas (or steps) to prove the correctness. Please try to understand why your algorithms or the algorithms given here are correct. 1. HW6Online. (20 pts.) 2. MST Stuff. (30 pts.) You are given an undirected weighted graph G = ( V,E ) with n vertices and m edges. Assume the weights of the edges are all distinct. (A) (10 pts.) Let E ⊆ E be the set of those edges of G with weight less than or equal to the median of edge weights. Give an O ( n + m ) time algorithm to determine whether the MST of G uses only edges in E or not. Solution : Let G = ( V,E ) be the subgraph of G that has E as edges and V as vertices. Using DFS, we can check whether G is connected or not. We report that the MST of G uses only edges in E if and only if G is connected. Since we can construct G in O ( m + n ) time and DFS takes O ( m + n ) time as well, we conclude the algorithm has O ( m + n ) running time. Note: Can you show the correctness using the “Reverse Delete Algorithm” in the lecture note (slide 8 / 54 in lecture note 12)? Rubrik : • 10pts: Correct algorithm with running time O ( m + n ). Otherwise, if the writeup gives a key idea it gets 6pts. 1 (B) (20 pts.) Give an O ( n + m ) time algorithm that outputs the heaviest edge in the (unique) MST of G . Solution : Let e 1 ,e 2 ,...,e m be the edges that are sorted in increasing order of weights. Let E i = { e 1 ,e 2 ,...,e i } . Note that the heaviest edge in the MST of G is e i such that the graph ( V,E i ) is connected but the graph ( V,E i 1 ) is disconnected. Hence our goal is to find such e i in...
View
Full
Document
This note was uploaded on 04/18/2011 for the course CS 473 taught by Professor Chekuri,c during the Spring '08 term at University of Illinois, Urbana Champaign.
 Spring '08
 Chekuri,C
 Algorithms

Click to edit the document details