- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

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

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

- Related Articles
- Construct a Turing Machine for language L = {wwr | w ∈ {0, 1}}
- Construct a Turing Machine for L = {a^n b^n | n>=1}
- Construct a Turing Machine for language L = {ww | w ∈ {0,1}}
- Construct Turing machine for L = {an bm a(n+m) - n,m≥1} in C++
- Construct a Turing machine for L = {aibjck | i< j< k; i ≥ 1}
- Construct a Turing machine for L = {aibjck | i>j>k; k ≥ 1}
- Construct a Turing machine for L = {aibjck | i*j = k; i, j, k ≥ 1}
- Construct Turing machine for addition
- Construct Turing machine for subtraction
- Construct a PDA for language L = {0n 1m2m3n | n>=1, m>=1}
- Construct PDA for L = {0n1m2(n+m) | m,n >=1}
- Construct a Turing machine for adding 2 to the binary natural number?
- Construct a ∈-NFA for the language L = (a* + b*)
- Construct PDA for accepting L = {anb(2n) | n>=1} U {anbn | n>=1}
- Construct ∈-NFA of Regular Language L = 0(0+1)*1