Homework 5

Homework 5 - W07/CS592 Homework Five Design and Analysis of...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
W07/CS592 Homework Five Design and Analysis of Algorithms Due: Apr. 17, Tuesday, 2007 There are 4 problems 1. Page 577, Problem 23-4 (a)(b). Alternative minimum-spanning tree algorithm In this problem, we give pseudocode for three different algorithms. Each one takes a graph as input and returns a set of edges T. For each algorithm, you must either prove that T is a minimum spanning tree or prove that T is not a minimum spanning tree. Also describe the most efficient implementation of each algorithm, whether or not it computes a minimum spanning tree. (a) MAYBE-MST-A( G , w ) 1 sort the edges into non-increasing order by their weights w 2 T E 3 for each edge e , taken in non-increasing order by weight 4 do if T – { e } is a connected graph 5 then T T –{ e } 6 Return T 7 End (b) MAYBE-MST-B( G , w ) 1 T φ 2 for each edge e , taken in arbitrary order 3 do if T { e }has no cycles 4 then T T { e } 5 Return T 6 End 2. (The widest path problem) Let P ( u , v ) be a path from vertex
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

Homework 5 - W07/CS592 Homework Five Design and Analysis of...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online