Analysis of Algorithms
CSE 5211
Fall 2011
Final Exam
Points
60
Intro to Analysis of Algorithms
CSE 4081
Fall 2011
Final Exam
Pts
60
Time: 110 min
Q1.
The following is a directed graph G:
V= {a, b, c, d, e, f, g, h, i}
E= {(a, b), (a, d), (b, c), (c, a),
(d, a), (d, e), (i, f), (f, g), (f, g), (g, h), (h, i)}
Draw the graph first.
Q1a.
Show a
pre-order
traversal numbered DFS spanning tree.
Pre-order as you touch a node, before making any call.
Q1b.
Show a
post-order
traversal numbered DFS spanning tree.
Post-order, when you return as there is no child to go to.
Q1c
. Find the
strong connected components
(
SCC
) in the graph by running the modified-
DFS algorithm. You may refer to the first DFS-spanning tree with post-order numbering,
then draw the reverse graph, and the second DFS spanning tree as the SCC’s.
(a,b,c,d) ( e) (i,f,g,h)
Q2
. Develop a Huffman coding over the following (node, frequency) pairs by running the
Greedy Huffman algorithm. The intermediate forest from each iteration must be shown.