COM S 331 : Theory of Computing
Fall Semester, 2015
Extra Credit Exam solution
Problem 1.
S aaXcc|aYc
X aaXcc|bbB
Y aaYcc|bB
B bbB|
Problem 2.
2
Choose = where p is the pumping length of L.
Case 2: v or y contains 2 or more distinct symbols. Without loss

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #11
Due Date: 5:00pm, Saturday, Dec.12
Homework Guideline:
1. Write your name and/or ISU ID at the beginning of the homework, preferably in the header.
2. All homework must be submitted throug

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #11 solution
Problem 1. 4.30
Let B be the equivalent enumerator of A. Without loss of generality, suppose < Mi > is the i-th
Turning Machine printed out by B. Consider the set of all possible

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #9
Due Date: 5:00pm, Wednesday, Nov.18
Homework Guideline:
1. Write your name and/or ISU ID at the beginning of the homework, preferably in the header.
2. All homework must be submitted throug

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #9 solution
Problem 1. 3.14
i. A Queue Automaton (QA) can be simulated by a 2-tape Turing Machine (TM). We use the first
tape to hold the original input string to the QA while simulate the que

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #6 solution
Problem 1 is trivial. Construct a 4 state PDA. The start state, intermediate state, loop state, and
accept state, as well as the transitions between them, as exactly the same as Ex

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #3
Due Date: 5:00pm, Friday, Sept.25
Homework Guideline:
1. Write your name and/or ISU ID at the beginning of the homework, preferably in the header.
2. All homework must be submitted through

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #6
Due Date: 5:00pm, Wednesday, Oct.21
Homework Guideline:
1. Write your name and/or ISU ID at the beginning of the homework, preferably in the header.
2. All homework must be submitted throug

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #2
Due Date: 5:00pm, Wednesday, Sept.16
Homework Guideline:
1. Write your name and/or ISU ID at the beginning of the homework, preferably in the header.
2. All homework must be submitted throu

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #4
Due Date: 5:00pm, Wednesday, Oct.7
Homework Guideline:
1. Write your name and/or ISU ID at the beginning of the homework, preferably in the header.
2. All homework must be submitted through

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #1 solution
Problem 1
a) (25 pts) The new DFA has i states: Q = {q0,q1, .qi_1}. A state qx E Q denotes the state
“current sum is x mod i”. Thus, go is naturally the start state and the only ac

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #8 solution
Problem 1. 3.7
Not enough details are given for step 1. It will not terminate since there could be infinite many
possible settings for xi (1 ) .
Problem 2. 3.11.
i. A standard TM c

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #4 solution
Problem 1. 2.14:
S AB|BA|BB|CC|BD|
A AB|BA|BB|CC|BD
B CC
C0
D AB
Problem 2. 2.26:
Fact 1: It takes n-1 steps to generate a string with length n, starts from S.
Fact 2: It takes n s

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #10 solution
Problem 1. 4.11
Construct the following TM that decides
TM =: On input <M>,
Convert M into a corresponding CFG G.
Compute the pumping length l of G.
If M accepts any string w lon

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #8
Due Date: 5:00pm, Wednesday, Nov.11
Homework Guideline:
1. Write your name and/or ISU ID at the beginning of the homework, preferably in the header.
2. All homework must be submitted throug

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #4 solution
Problem 1. 1.46 c) L = cfw_w|w cfw_0,1 is not a palindrome
Directly applying the pumping lemma on L is not effective. But we can take complement of L, and
show the following langua

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #3 solution
Problem 1 & 5 are trivial. Just follow the exact procedure show in Lemma 1.55.
Problem 2.
1.20:
subproblem
member
non-member
a)
ab,
ba, aba
b)
ab,abab
, aabb
c)
,aa
ab,aabb
d)
,aa

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #10
Due Date: 5:00pm, Wednesday, Dec.3
Homework Guideline:
1. Write your name and/or ISU ID at the beginning of the homework, preferably in the header.
2. All homework must be submitted throug

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #5
Due Date: 5:00pm, Wednesday, Oct.14
Homework Guideline:
1. Write your name and/or ISU ID at the beginning of the homework, preferably in the header.
2. All homework must be submitted throug

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #7
Due Date: 5:00pm, Wednesday, Oct.28
Homework Guideline:
1. Write your name and/or ISU ID at the beginning of the homework, preferably in the header.
2. All homework must be submitted throug

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #1
Due Date: 5:00pm, Wednesday, Sept.9
Homework Guideline:
1. Write your name and/or ISU ID at the beginning of the homework, preferably in the header.
2. All homework must be submitted throug

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #7 solution
Problem 1. 2.30
a) Assume the language L is CFL with a pumping length p. We show that string
= 0 1 0 1 cannot be pumped, which is a contradiction. Let = be any
partition of w. We

COM S 331 : Theory of Computing
Fall Semester, 2015
Assignment #2 solution
Problem 1.
1.1.4 a) Let be any regular language and the DFA accepts A. Let be the complement
DFA of .
Lemma: recognize the complement of .
To prove the lemma, we show the following

U.C. Berkeley — CS172: Automata, Computability and Complexity Solutions to Problem Set 1
Professor Luca Trevisan 2/1/2007
Solutions to Problem Set 1
1. Prove that the following languages are regular, either by exhibiting a regular expression
representin