CMPSCI 250: Introduction to Computation

David Mix Barrington

Fall, 2004

CMPSCI 250 Solution to Final Exam

Exam iven Mon 20 December 2004

Exam and solution posted Tue 21 December 2004

Minor corrections (in red) made 6 May 2005

.

There are six questions for 120 total points.

Questions are in black, solutions in blue.

Question 1 (30): In this problem we will carry out several of our constructions, beginning with an ordinary NFA N. This NFA has alphabet {a,b}, state set {1,2}, start state 1, final state set {2}, and transition relation Δ = {(1,a,1), (1,a,2), (1,b,2)}.

Question 2 (10): Suppose that we are converting a λ-NFA M to an ordinary NFA N, and that (p,a,q) is a letter move of M. Explain what letter moves must be added to N to account for this move of M. Explain why these moves in N account for every possible path in M where (p,a,q) is the only letter move in the path.

We must add the letter move (r,a,s) where r is any state with a λ-path to p and s is any state with at λ-path from q. (Either or both of r=p or s=q are possible.) Any path in M that has only the one letter move (p,a,q) must have zero or more λ-moves (a λ-path from some state r to p), the letter move (p,a,q), and then zero or more λ-moves from q to some state s. We thus account for this path with the move (r,a,s), which we have added to n. Clearly all the letter moves we add to N do correspond to paths in M in which (p,a,q) is the only letter move.

Question 3 (20): For any natural n, the undirected graph Kn has n vertices and all possible edges (that is, it has an edge between i and j whenever i ≠ j).

Question 4 (25): Define E to be the set of strings in {a,b}* that have an equal number of a's and b's. For example, the strings in E whose length is at most four are: λ, ab, ba, aabb, abab, abba, baab, baba, and bbaa.

Question 5 (15): This problem deals with some statements in the predicate calculus. The type of the variables is "animal" and we are given four unary predicates: F(x) means "x can fly", G(x) means "x is a gnu", H(x) means "x has hooves", and W(x) means "x has wings".

Question 6 (20): Define a function h(n) from naturals to naturals recursively as follows. If n ≤ 2, then h(n) = n. If n > 2, then h(n) = h(n-1) - h(n-2) + h(n-3).

Last modified 26 May 2005