This preview shows pages 1–2. Sign up to view the full content.
W07/CS592
Homework Five
Design and Analysis of Algorithms
Due: Apr. 17, Tuesday, 2007
There are 4 problems
1.
Page 577, Problem 234 (a)(b).
Alternative minimumspanning 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)
MAYBEMSTA(
G
,
w
)
1
sort the edges into nonincreasing order by their weights
w
2
T
←
E
3
for
each edge
e
, taken in nonincreasing order by weight
4
do if
T – {
e
} is a connected graph
5
then
T
←
T –{
e
}
6
Return
T
7
End
(b)
MAYBEMSTB(
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
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.
 Winter '05
 Shen
 Algorithms

Click to edit the document details