NAME: Final Exam |
May 24, 2001 Computer Science 226 |
This test is 20 questions, each worth 5 points, for a total of 100 points. Do all of your work on these pages (use the back for scratch space), giving the answer in the space provided. Put your name on every page (now), and write out and sign the Honor Code pledge before turning in the test. You have three hours to complete the test.
``I pledge my honor that I have not violated the Honor Code during
this examination.''
1. ___/5 2. ___/5 3. ___/5 4. ___/5 5. ___/5 6. ___/5 7. ___/5 8. ___/5 9. ___/5 10. ___/5 11. ___/5 12. ___/5 13. ___/5 14. ___/5 15. ___/5 16. ___/5 17. ___/5 18. ___/5 19. ___/5 20. ___/5 TOTAL: ___/100
0 1 2 3 ------------- 0 | 0 2 0 3 1 | 1 1 3 3
0 1 2 3 4 5 6 7 ------------------------ 0 | 0 2 0 4 5 0 2 8 1 | 1 1 3 1 X 6 7 1
A. The deterministic FSA might have an exponential number of states. B. There might exist a string that the deterministic FSA recognizes but the nondeterministic FSA does not. C. There might exist a string that the nondeterministic FSA recognizes but the deterministic FSA does not. D. The nondeterministic FSA might loop. E. The proof of the theorem is not constructive (does not tell us how to construct the deterministic FSA).
a ____ c ____ g ____ t ____
A. log N B. (log N)*(log N) C. square root of N D. N * log N E. N LZ _____ LZW _____
(2, 1) (4, 4) (5, 2) (10, 2) (7, 5) (1, 6) (8, 4)
(1, 1) (4, 5) (3, 3) (5, 3) (6, 1) (7, 3) (4, 0) (3, 2)Assume that the scan is counter-clockwise, starting from the point with smallest y-coordinate. Give the order of points being scanned, and, for each point that is not on the convex hull, the point most recently added to the hull when is it eliminated in the scan.
0-7 0-1 1-4 1-6 2-3 3-4 4-2 5-2 6-0 6-3 6-5 7-1 7-3 .Draw the DFS tree for the standard adjacency-matrix representation. List the edges of each type in the space provided below.
Tree edges: Back edges: Down edges: Cross edges:
___ Find the largest complete subgraph. ___ Find a set of edges that separates the graph. ___ Find a path that uses each vertex exactly once, or report that none exists. ___ Find a path that uses each edge exactly twice, or report that none exists. ___ Find the smallest set of edges that connects all the vertices. ___ Find the vertices in a digraph that are not on a directed cycle.
___ Bellman-Ford A. MST for dense graphs ___ Ford-Fulkerson B. maxflow ___ Kruskal C. transitive closure ___ network simplex D. MST for sparse graphs ___ Floyd E. negative-cycle detection ___ Prim F. strong components ___ Warshall G. all-pairs shortest paths in dense graphs ___ Dijkstra H. mincost maxflow ___ Kosaraju I. single-source shortest paths
(0-1, 1) (0-4, 4) (0-6, 1) (0-5, 2) (1-2, 1) (1-4, 2) (1-6, 3) (2-3, 2) (2-5, 3) (3-4, 1) (4-5, 1) (5-6, 3)where (i-j, w) means that the edge that connects node i to node j has weight w. Give the parent-link representation of the MST computed by Prim's algorithm, using the standard adjacency-matrix representation.
(0-1, 6, 1) (0-2, 4, 3) (0-3, 4, 4) (1-2, 3, 1) (1-3, 3, 1) (2-4, 4, 1) (3-4, 4, 1) (2-5, 3, 5) (3-5, 3, 6) (4-5, 5, 2)where (i-j, w, c) means that there is an edge from node i to node j with capacity w and cost c. Add a dummy edge (5-0, 11, -9) and give a sequence of augmenting cycles that yield a mincost maxflow.
0 1 2 3 4 5 6 7 8 9 ---------------------------- 0 2 0 8 2 6 7 4 4 4Give the parent-link representation of the tree that results from adding the edge 5-1 and removing the edge 2-4.
___ graph coloring A. linear-time algorithm known ___ linear programming B. polynomial-time (superlinear) algorithm known ___ convex hull C. NP-hard ___ graph planarity D. unknown ___ maximum flow ___ minimum spanning tree ___ graph isomorphism ___ string matching