COS 226 Final: COS 226 Princeton Final Fall 12

41 views17 pages

Document Summary

This test has 16 questions worth a total of 100 points. The exam is closed book, except that you are allowed to use a one page cheatsheet (8. 5-by-11, both sides, in your own handwriting). No calculators or other electronic devices are permitted. Give your answers and show your work in the space provided. Write out and sign the honor code pledge before turning in the test. I pledge my honor that i have not violated the honor code during this examination. Use tilde notation to simplify your answer. public class kmp { private int[][] dfa; private char[] pat; public kmp(string pattern, int r) { int m = pattern. length(); dfa = new int[r][m]; pat = new char[m]; E 2 (c) suppose that a digraph is represented using the adjacency-lists representation. E 2 (d) suppose that a digraph is represented using the adjacency-matrix representation.