AMS 301.2 (Spring, 2010)
Estie Arkin
Exam 2 – Solution sketch
Mean 73.16, median 75, top quartile 82, high 95, low 36.
1. (5 points) Let
T
be a 4ary tree with 200 internal nodes. How many leaves does the tree have?
(A correct guess with no work shown will recieve very partial credit.)
n
=
mi
+ 1,
m
= 4,
i
= 200, so
n
= 801,
l
=
n

i
= 601
2. (9 points) Consider the following graph.
A
B
C
D
E
F
G
H
5
5
3
3
7
2
2
3
1
1
4
6
2
2
5
(a).
Highlight the edges of a minimum spanning tree of the graph.
Using Kruskal’s algorithm,
egdes would be put into the MST in the following order: (A,D) (C,D) (C,F) (B,A) (C,G) (B,E)
(G,H). The cost of this tree is 13.
A
B
C
D
E
F
G
H
3
2
2
1
1
2
2
(b).
Edge (A,B) is currently part of the MST, however its cost is uncertain.
What are all the
possibles costs of the edge for which it will be part of the MST? Explain briefly.
(Your answer
should be of the sort cost is greater than 3 and less than or equal to 17.)
Edge (A,B) connects the nodes B,E to the rest of the nodes A,C,D,F,G,H. Instead of it, we could
use any one of the edges (B,C) (B,F) (E,F) (E,H), and we would choose the smallest cost among
them, (B,C) of cost 4. So as long as the cost of (A,B) is at most 4, we would put it into the MST.
If its cost is larger than 4, then instead we would put (B,C).
3. (20 points) True or False? Make sure to explain! (The best explanation if true, is a short proof,
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
and if false, a counterexample.) We are given a connected graph
G
with costs on edges. Assume
all costs are positive and that there are no ties.
A
and
B
are two of the nodes in the graph.
(a). A BFS on
G
rooted at node
A
has the same number of edges as a BFS on
G
rooted at node
B
. True. The number of edges in a spanning tree of
G
is always
n

1 where
n
is the number of
nodes.
(b). A BFS on
G
rooted at node
A
has the same number of leaves as a BFS on
G
rooted at node
B
. False. Consider the graph on nodes A,B,C,D with edges (A,B), (A,C), (A,D) and (B,C). A BFS
starting at A would have 3 leaves B,C,D, whereas a BFS starting at B would have 2 leaves A,D.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '11
 Estie

Click to edit the document details