CS 373
Midterm 2 (April 3, 2001)
Spring 2001
1. Using any method you like, compute the following subgraphs for the weighted graph below.
Each subproblem is worth
3
points. Each incorrect edge costs you
1
point, but you cannot get
a negative score for any subproblem.
(a) a depthfirst search tree, starting at the top vertex;
(b) a breadthfirst search tree, starting at the top vertex;
(c) a shortest path tree, starting at the top vertex;
(d) the
maximum
spanning tree.
8
7
5
6
0
3
9
10
12
2
1
4
11
2.
(a)
[4 pts]
Prove that a connected acyclic undirected graph with
V
vertices has exactly
V

1
edges. (“It’s a tree!” is not a proof.)
(b)
[4 pts]
Describe and analyze an algorithm that determines whether a given undirected
graph is a tree, where the graph is represented by an adjacency list.
(c)
[2 pts]
What is the running time of your algorithm from part (b) if the graph is repre
sented by an adjacency matrix?
3. Suppose we want to sketch the Manhattan skyline (minus the interesting bits like the Empire
State and Chrysler builings). You are given a set of
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.
 Spring '09
 A
 Graph Theory, staircase layers

Click to edit the document details