CMPSCI 501: Theory of Computation

Solutions to First Midterm Exam, Spring 2014

David Mix Barrington

19 February 2014

Directions:

  Q1: 10 points
  Q2: 10 points
  Q3: 10 points
  Q4: 10 points
  Q5: 10 points
  Q6: 10 points
  Q7: 40 points
  Q8: 25 points
  Q9: +10 points
 Total: 125+10 points

Question text is in black, solutions in blue.

The language X is the set of all strings in {a, b}* in which every b has an a immediately before it and an a immediately after it.

If w is any string, wR is w written backwards. For example, (abaab)R = baaba.

The function f from strings in {a, b}* to strings in {a, b}* replaces each a in the input with ab and each b in the input with ba. Thus, f(aba) = abbaab.

Language Y is the set of all strings of the form w(f(w))R where w is any string in {a, b}R. For example, taking w = aba, we see that ababaabba is in Y because it is the concatenation of w = aba and f(w)R = baabba.

Language Z is the set of all strings of the form wf(w) where w is any string in {a, b}*. For example, taking w = aba, we find that abaabbaab is in Z.

The NFA N has input alphabet {a}, state set {i, p, q, r, s, t}, final state set {i, p, r, s}, and transition function δ defined as follows: δ(i, a) = {p, r}, δ(p, a) = {q}, &delta(q, a) = {p}, δ(r, a) = {s}, δ(s, a) = {t}, δ(t, a) = {r}, and for all states u, δ(u, ε) = ∅. This last definition means that there are no ε-moves in N.

Last modified 23 February 2014