
CPSC 212-302 Name: _____________________________
Test #3, Part B April 26, 2006
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) How many edges does an undirected complete graph with N nodes have? Be precise. Your answer
should be expressed in terms of N. The graph is undirected so edge (u,v) = (v,u) is counted only once.
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 4.
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”.
___ PAMONBCKHJIGFKDE
___ APBCDMLONHJIFGKE
___ PONABMLCDHIJGFKE
___ ABPMONCDHJILKGFE
___ POANBMHGCLJIFKDE