(b) In a digraph in which every vertex has exactly one inedge and exactly one outedge the number
of edges equals the number of vertices, true or false?
(c) A binary search tree that has the redblack tree balance property is an AVL tree, true or false?
(d) A minheap contains the keys 1
,
2
,...,
127. The height of the heap is 6, true or false?
(e) In a simple graph with
n
vertices the number of simple paths of length 2 is
O
(
n
3
), true or false?
3. (15 points) Prove that if
f
(
n
) is
O
(
n
) and
g
(
n
) is Ω(
n
) then
f
(
n
) is
O
(
g
(
n
)). You cannot use any of
the theorems stated in the lecture notes, the textbook, or the lab notes. Your proof should rely only
on the deﬁnition of BigOh.
4. (20 pts) Consider the following graph
G
with vertices 1
,
2
,
3
,
4
,
5
,
6 and edges
12,
13,
23,
24,
25,
35,
36,
45,
56
(a) Suppose we run the breadthﬁrst search algorithm on
G
, starting at node 1 and such that the
algorithm explores the edges incident to a node in the numerical order of the labels of the node
at the other end. What
cross
edges does the algorithm ﬁnd?
(b) Draw the spanning tree of discovery edges produced by the algorithm stated in (a).
(c) For the same graph
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
 TANNEN
 Algorithms, Data Structures, pts

Click to edit the document details