
U.C. Berkeley — CS172: Automata, Computability and Complexity Practice Final Exam
Professor Luca Trevisan December 13, 2009
Practice Final Exam
1. Let L={wtw :w, t ∈Σ∗}. Show that Lis not regular.
2. Let L={hri:ris a regular expression that accepts at least 2 strings}. Show that Lis de-
cidable.
3. Let L={hx, y, ni: max(K(x), K (y)) ≥n}. Show that Lis not recognizable.
4. Let L={hM1, M2i:L(M1) = L(M2)}. Show that Lis not recognizable.
5. We define the NEIGHBOR problem as follows. An instance consists of an undirected graph
G= (V, E ) and an integer k. We must decide if there is a subset of nodes V0where every
node in Vis a distance of at most 1 from some node in V0. Additionally, we require |V0| ≤ k.
As an example, let V={a, b, c}and E={{a, b},{b, c}} and k= 1. Then V0={b}satisfies
the NEIGHBOR problem since aand care adjacent to b.
Show that NEIGHBOR is NP-complete.
6. Define U CY CLE ={hGi:Gis an undirected graph that contains a simple cycle}. Show
that UCY C LE ∈L. (Note: Gmay not be connected.)
Hint. We can search through Gby traversing the edges incident on a vertex in lexicographic
order. That is, if we come in through the ith edge, we go out through the (i+ 1)th edge or
the first if the degree is i. How does this algorithm behave on a tree? On a graph with a
cycle?
7. Show that TIME(O(n2)) (the set of languages accepted by quadratic-time Turing machines)
is distinct from P.
1