CS 341: Foundations of Computer Science II
Prof. Marvin Nakayama
Homework 13 Solutions
1. The Set Partition Problem takes as input a set S of numbers. The question is
whether the numbers can be partit
CS 341: Foundations of Computer Science II
Prof. Marvin Nakayama
Homework 12 Solutions
1. (a) Show that NP is closed under union.
Answer:
Let L1 and L2 be languages in NP. Also, for i = 1, 2, let Vi (
CS 341: Foundations of Computer Science II
Prof. Marvin Nakayama
Homework 8 Solutions
1. Consider the problem of testing whether a DFA and a regular expression are equivalent. Express this problem as
CS 341: Foundations of Computer Science II
Prof. Marvin Nakayama
Homework 7 Solutions
n
1. The Turing machine M below recognizes the language A = cfw_ 02 | n 0 .
0 0, L
x x, L
q5
x x, R
,R
x x, R
q1
CS 341: Foundations of Computer Science II
Prof. Marvin Nakayama
Homework 6 Solutions
1. Give pushdown automata that recognize the following languages.
(a) A = cfw_ w cfw_0, 1 | w contains at least th
CS 341: Foundations of Computer Science II
Prof. Marvin Nakayama
Homework 5 Solutions
1. Give context-free grammars that generate the following languages.
(a) cfw_ w cfw_0, 1 | w contains at least thr
CS 341: Foundations of Computer Science II
Prof. Marvin Nakayama
Homework 2 Solutions
1. DFA M = (Q, , , q1 , F ), where
Q = cfw_q1 , q2 , q3
= cfw_a, b
transition function is given by
q1
q2
q3
ab
q
CS 341: Foundations of Computer Science II Prof. Marvin Nakayama
Homework 4
1. Use the procedure described in Lemma 1.55 to convert the regular expression (00) (11) 01) into an NFA. Answer:
0 1 00 11
CS 341: Foundations of Computer Science II Prof. Marvin Nakayama
Homework 3 Solutions
1. Give NFAs with the specied number of states recognizing each of the following languages. In all cases, the alph
CS 341: Foundations of Computer Science II Prof. Marvin Nakayama
Homework 13
1. The Set Partition Problem takes as input a set S of numbers. The question is whether the numbers can be partitioned into
CS 341: Foundations of Computer Science II Prof. Marvin Nakayama
Homework 9
1. Let B be the set of all innite sequences over cfw_0, 1. Show that B is uncountable, using a proof by diagonalization. 2.
CS 341: Foundations of Computer Science II Prof. Marvin Nakayama
Homework 3
1. Give NFAs with the specied number of states recognizing each of the following languages. In all cases, the alphabet is =