
CPSC 212-301 Name: Answer Key
Test #3, Part B November 30, 2005
Closed books. Closed Notes. Calculators OK. 85 points. 60 minutes. The weight of each question is
indicated in parentheses. Please use a pencil. If you need more space, use the back of the sheet.
1. (10) Definitions. Consider graph G1. Then answer the following questions.
____ (a) (T/F) The graph is strongly connected. G1:
____ (b)What is the cost of the shortest path between nodes C and E?
____ (c) Which node has the greatest outdegree?
____ (d) A is adjacent to which nodes?
____ (e) (T/F) The graph is a complete graph.
2. (10) Apply Dijkstra’s algorithm to graph G2. Put the final
values produced by the algorithm in the table below.
Start with node 0.
dv pv G2:
0 ____ ____
1 ____ ____
2 ____ ____
3 ____ ____
4 ____ ____
5 ____ ____
3. (10) Consider graph G3. For each of the following sequences of nodes, mark with a “T” those
which represent a topological sort of the
graph and with an “X” those which do not.
_____ (a) A B C D E I G F H G3:
_____ (b) A B C E D I G F H
_____ (c) A B C E D G F I H
_____ (d) A B C E D F I G H
_____ (e) A B C I E G D F H
4. (5) Your friend says that he used the following Huffman Code: a=110, e=01, t=101, s=011
to generate this encoded message: 10111001110101. Can you decode his message? If so, what is his
message? If not, explain precisely why you cannot.