Sample Answers

MCS4653, Theory of Computation
Page
Sample
Homework Assignment 11, Due 11/26/03
1
Answers
(Sudkamp 9.3 pages 291-2)
Construct a Turing machine with the input alphabet {a, b} to perform each of the following operations. Note that the
tape head is scanning position zero in state qf whenever the computation terminates.
a) Move the input one space to the right. Input configuration q0 BuB, result qf BBuB.
j
q3
a/a R
b/b R
a/B R
B/a L
jB/B R qjB/B L qj
q0
f
1
j
q4
B/B L
b/B R
B/b L
j
q5
b) Concatentate a copy of the reversed input string to the input. Input configuration q0 BuB, result qf BuuR B.
X/X R
Y /Y R
a/a R
b/b R
j
q3
a/a R
b/b R
jB/B R qjB/B L qj
q0
1
2
B/B R
X/X L
Y /Y L
jB/B L qj
qf
j
X/a R
Y /b R
X/X R
Y /Y R
a/a R
b/b R
R
j a/a
b/b R
q3
a/X R
b/Y R
or
X/a R
jB/B R qjB/B L qj
q0
X/X L
Y /Y L
B/b L
b/Y R
q5
6
a/a L
a/a L b/b L
b/b L
B/a L
a/X R
B/a L
f
1
a/a L
b/b L
Y /b R
B/b L
R
j a/a
b/b R
q4
L
j a/a
b/b L
q4
Sample
Answers
MCS4653, Theory of Computation
Homework Assignment 11, Due 11/26/03
Page
2
c) Insert a blank between each of the input symbols. For example, input configuration q0 BabaB, result qf BaBbBaB.
a/a R
b/b R
j
j
q2
a/X R
b/Y R
q4
B/B L
jB/B R qj
q0
j
q3
1
B/B L Z/Z R
j
qf
j
B/a L
Z/a L
a/Z R
X/X R
Y /Y R
j
q6
q7
B/B L
j
q5
Z/Z L
B/b L
b/Z R
Z/b L
X/a L
Y /b L
Z/B L
d) Erase the b’s from the input. For example, input configuration q0 BbabaababB, result qf BaaaaB.
a/a R
a/a L
jB/B R qjB/B L qj
q0
j
f
s
q2
a/a R
b/b R
B/B R
b/b R
a, b/X R
a/a L
ja, b/B L qjB/B L qj
q6
X/a L
Y /b L
5
1
a/a R
b/b R
a, b/Y R
b/b L
j
q3
j
q4