Key concepts
A Turing Machine consists of:
Which of the following components of an assembly language would best correspond to the above? $ K,\Sigma, \delta, q_0, F$
1.1 What does the following TM do?
$ M=(K,\Sigma,q_0,\delta,F)$ where $ K=\{q_0,q_1,q_2\}$ , $ F=\{q_2\}$ , $ \Sigma=\{0,1,\#\}$ and $ \delta$ is defined as below:
0 | 1 | # | |
---|---|---|---|
$ q_0$ | $ (q_0,1,R)$ | $ (q_0,0,R)$ | $ (q_1,0,L)$ |
$ q_1$ | $ (q_1,0,L)$ | $ (q_1,1,L)$ | $ (q_2,\#,R)$ |
1.2 Write a TM which enters the final state only if the input is a binary encoding of an even natural number.
1.3 Write a TM which verifies if a given word over alphabet $ {A,B}$ contains the sequence ABA
.
1.4 Write a TM which adds 5 to a number encoded in binary on the tape.
1.5 Write a TM which checks if a binary number x
is strictly larger than y
. Hint: use a separator symbol between words.
How would the following algorithm be represented as a Turing Machine:
Algorithm(vector V, integer M) { integer s = 0 for-each x in V s += x if (s > M) then return 1 else return 0 }
Helpful questions:
foreach x in V
be implemented?s += x
be implemented?if (s > M) then … else …
be implemented ?