## Related Articles

• Write an Interview Experience

# Turing machine for copying data

• Difficulty Level : Medium
• Last Updated : 29 Jul, 2020

Prerequisite – Turing Machine
Problem – Draw a Turing machine which copy data.

Example –

Steps:

• Step-1. First convert all 0’s, 1’s into 0’s, 1’s and go right then B into C and go left

• Step-2. Then convert all 0’s, 1’s into 0’s, 1’s and go left then

• Step-3. If 1 convert it into X and go right convert all 0’s, 1’s into 0’s, 1’s and go right then convert C into C and go right then convert all 0’s, 1’s into 0’s, 1’s and go right then convert B into 1 and go left then convert all 0’s, 1’s into 0’s, 1’s and go left then convert C into C and go left then convert all 0’s, 1’s into 0’s, 1’s and go left then convert all X into X and go right and then repeat all the process from step-2 till end

• Step-4. If 0 then convert it into Y and go right then convert all 0’s, 1’s into 0’s, 1’s and go right then convert C into C and go right then convert all 0’s, 1’s into 0’s, 1’s and go right then convert B into 0 and go left then convert all 0’s, 1’s into 0’s, 1’s and go left then convert C into C and go left then convert all 0’s, 1’s into 0’s, 1’s and go left then convert all Y into Y and go right and then repeat all the process from step-2 till end

• Step-5. Otherwise if C found convert it into C and go left then convert all X into 1 and Y into 0 and go left then convert B into B and go right and stop the machine.

Turing machine for copying data

Here, q0 shows the initial state and q1, q2, ….., q9, q11are the transition states and q12shows the final state.
And 0, 1 is the data inside a machine and X, Y, C are the variables used for copy data and R, L shows right and left.

My Personal Notes arrow_drop_up