
CS 170, Spring 1999
Midterm Exam II
Professor Christos Papadimitriou
1. (2 points each question) True or false? Circle the correct answer. No points will be
subtracted for incorrect answers so guess all you want.
T F In an undirected graph, the shortest path between two nodes always lies on some
minimum spanning tree.
T F If all edges of a graph have different weights the minimum spanning tree is
unique.
T F If all edges of a graph have different weights the second-best minimum spanning
tree is unique.
T F Prim's algorithm for computing minimum spanning trees runs in O(|V²|) steps.
T F In a depth first search on a directed acyclic graph, the vertex with the highest
postorder number is necessarily a source.
T F In Huffman coding, the item with the second-lowest probability is always at the
leaf that is furthest from the root.
T F In Huffman coding, the item with the highest probability is always at the leaf that
is closest to the root.
T F In Huffman coding, the item with the highest probability is always at a leaf that is
the child of the root.
T F If a set of Horn clauses contains no clause with a single literal, then it is
satisfiable.
T F A set of Horn clauses can be tested for satisfiability in linear time.
T F In a depth-first search of a directed graph, it is possible to have an edge between
two vertices u and v with previsit and postvisit numbers: (10, 40) for u and (30,50)
for v.
T F In a depth-first search of an undirected graph, it is possible to have an edge
between two vertices u and v with previsit and postvisit numbers: (5, 20) for u and
(30, 50) for v.
T F In a depth-first search of a directed graph, it is possible to have an edge between
two vertices u and v with previsit and postvisit numbers: (5, 20) for u and (30, 50)
for v.