
CPSC 212-302 Name: _____________________________
Test #3, Part B April 11, 2007
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) Assume that a graph is such that for node i (0 ≤ i < N), there is a directed edge to all nodes j > i.
How many directed edges does this graph have? Be precise. Your answer should be expressed in terms of
N. Explain clearly how you arrived at your answer (you will get at most one point credit if all you give me
is your final answer).
2. (10) Apply Dijkstra’s algorithm to graph G1. Put the final values produced by the algorithm in the table
below. Start with node 5.
dv pv G1:
0 ____ ____
1 ____ ____
2 ____ ____
3 ____ ____
4 ____ ____
5 ____ ____
3. (5) Topological Sort. Consider graph G2. Which of the following is not a topological sort of G2? Mark
each with an “X”.
___ POANBMHGCLJIFKDE
___ PONABMLCDHIJGFKE
___ PAMONBCKHJIGFKDE
___ ABPMONCDHJILKGFE
___ APBCDMLONHJIFGKE