CS 21
Decidability and Tractability
Winter 2014
Midterm Solutions
Out: February 12
1. (a) The language L1 is not context-free.
To see it is not context-free, we use the CFL pumping lemma: let w = ap bp cp dp , and
consider the ways w can be written as w =
CS 21
Decidability and Tractability
Winter 2014
Midterm
Out: February 5
Due: February 12
This is a midterm. You may consult only the course notes and the text (Sipser). You may not
collaborate. The full honor code guidelines can be found in the course syl
CS 21
Decidability and Tractability
Winter 2014
Final Exam Solutions
Posted: March 19
If you have not turned in the nal, obviously you should not consult these solutions.
1. (a) L is in PSPACE via the following recursive algorithm. In general we are given
CS 21
Decidability and Tractability
Winter 2014
Solution Set 1
Posted: January 22
If you have not yet turned in the Problem Set, you should not consult these solutions.
1. We need to dene a language that has the same computational power as the function f
CS 21
Decidability and Tractability
Winter 2014
Problem Set 6
Out: February 26
Due: March 5
Reminder: you are encouraged to work in groups of two or three; however you must turn in your
own write-up and note with whom you worked. You may consult the cours
CS 21
Decidability and Tractability
Winter 2014
Problem Set 3
Out: January 29
Due: February 5
Reminder: you are encouraged to work in groups of two or three; however you must turn in your
own write-up and note with whom you worked. You may consult the cou
CS 21
Decidability and Tractability
Winter 2014
Problem Set 5
Out: February 21
Due: February 28
Reminder: you are encouraged to work in groups of two or three; however you must turn in your
own write-up and note with whom you worked. You may consult the c
CS 21
Decidability and Tractability
Winter 2014
Problem Set 4
Out: February 12
Due: February 19
Reminder: you are encouraged to work in groups of two or three; however you must turn in your
own write-up and note with whom you worked. You may consult the c
CS 21
Decidability and Tractability
Winter 2014
Problem Set 1
Out: January 15
Due: January 22
Reminder: you are encouraged to work in groups of two or three; however you must turn in your
own write-up and note with whom you worked. You may consult the cou
CS 21
Decidability and Tractability
Winter 2014
Problem Set 2
Out: January 22
Due: January 29
Reminder: you are encouraged to work in groups of two or three; however you must turn in your
own write-up and note with whom you worked. You may consult the cou
CS 21
Decidability and Tractability
Winter 2014
Problem Set 7
Out: March 5
Due: March 12
Reminder: you are encouraged to work in groups of two or three; however you must turn in your
own write-up and note with whom you worked. You may consult the course n
CS 21
Decidability and Tractability
Winter 2014
Solution Set 4
Posted: February 19
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,
CS 21
Decidability and Tractability
Winter 2014
Solution Set 7
Posted: March 12
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 2014
Solution Set 5
Posted: February 28
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 2014
Solution Set 2
Posted: January 29
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 2014
Solution Set 3
Posted: February 5
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 2014
Final
Out: March 12
Due: March 19, noon
This is a nal. You may consult only the course notes and the text (Sipser). You may not
collaborate. The full honor code guidelines can be found in the course syllabus