CS 21
Decidability and Tractability
Winter 2012
Midterm Solutions
Out: February 13
1. (a) The language L1 is context free but not regular. To see it is context free, consider the
NPDA that rst pushes as onto the stack until it sees the rst b, then pops as
CS 21
Decidability and Tractability
Winter 2013
Final Exam Solutions
Posted: March 20
If you have not turned in the nal, obviously you should not consult these solutions.
1. (a) This problem is in PSPACE. We give a recursive algorithm. We are given a sequ
CS 21
Decidability and Tractability
Winter 2013
Solution Set 7
Posted: March 13
If you have not yet turned in PS7, you should not consult these solutions.
1. To see that the language is in NP, we simply note that a witness for an n-symbol input y is
the u
CS 21
Decidability and Tractability
Winter 2013
Solution Set 6
Posted: March 6
If you have not yet turned in the Problem Set, you should not consult these solutions.
1. First, observe that subgroup isomorphism is in NP, because if we are given a specicati
CS 21
Decidability and Tractability
Winter 2013
Solution Set 3
Posted: February 6
If you have not yet turned in the Problem Set, you should not consult these solutions.
1. (a) A 2-NPDA is a 7-tuple (Q, , 1 , 2 , , q0 , F ), where Q, , 1 , 2 and F are all
CS 21
Decidability and Tractability
Winter 2013
Solution Set 5
Posted: February 27
If you have not yet turned in the Problem Set, you should not consult these solutions.
1. (a) False. By the Time Hierarchy Theorem there are problems that are solvable in t
CS 21
Decidability and Tractability
Winter 2013
Solution Set 2
Posted: January 30
If you have not yet turned in the Problem Set, you should not consult these solutions.
1. We build a NPDA for L. There will be four states, labeled match, add-one, addtwo, a
CS 21
Decidability and Tractability
Winter 2013
Solution Set 4
Posted: February 20
If you have not yet turned in the Problem Set, you should not consult these solutions.
1. We will reduce 2-COLORABLE to 2-SAT, which we showed to be in P . Given a graph
G,