Construct a Turing Machine for language L = {0n1n2n | n≥1}

C++Server Side ProgrammingProgramming

Here we will see how to make a Turing machine for language L = {0n1n2n | n ≥ n}. So this represents a kind of language where we will use only three characters 0s, 1s and 2s. The w is a string. So if w = 000111222, The Turing machine will accept it.

To solve this, we will use this approach. First replace one 0 from front by x, then keep moving right till we get one 1 and replace this 1 by y. Again, keep moving right till we get one 2, replace it by z and move left. Now keep moving left till we will find one x. When we will get it, move a right, then follow the same procedure as above.

A condition comes when we find a x immediately followed by a y. At this point we keep moving right and keep on checking that all 1’s and 2’s have been converted to y and z or not. If not, then string is not accepted. If we reach $ then string is accepted.

State Transition Diagram

raja
Published on 03-Jan-2020 11:27:17
Advertisements