Turing machine for Regular languages
Regular languages can be represented through finite automata and similarly can be represented through Turing Machine.
This machine must accept all strings starting from a and ending with b. e.g, ab,aab, abab etc.
Let’s discuss the diagram;
Start:
Starts the machine
a,a,R:
Read a from input tape and write a and move Right on input tape.
State 2:Â
Read a from input tape and write a and move Right on input tape. There is a loop of a, a, R on state 2.Â
If read b from input tape, then write b and move right and halts the machine by accepting the string.
If there is any a on accept state then again control moves to the state 2, enforcing the machine to not end with a.
Turing machine Diagram
Demo of Turing machine ExecutionÂ
Question: String ab can be ready by this Turing machine or not? If it can be read then what will be the path?
Answer:
Yes, this string can be read by the Turing machine in the Path of machine execution is mentioned below.
Path: start > 2 > accept.
Question: String ba can be ready by this Turing machine or not? If it can be read then what will be the path?
Answer: Sorry this string can’t be read by this Turing machine because this machine only can read the strings that are started with alphabet a
Question: String abbba can be ready by this Turing machine or not? If it can be read then what will be the path?
Answer:
Answer: Sorry this string can’t be read by this Turing machine because this machine only can read the strings ended with alphabet b.
Path: start > 2 > accept > accept > accept > 2. Here, 2 is the ending state but actual ending state is “accept”.
Question: String ababab can be ready by this Turing machine or not? If it can be read then what will be the path?
Answer:
Yes, this string can be read by the Turing machine in the Path of machine execution is mentioned below.
Path: start > 2 > accept > 2 > accept > 2 > accept.
Question: String abbbb can be ready by this Turing machine or not? If it can be read then what will be the path?
Answer:
Yes, this string can be read by the Turing machine in the Path of machine execution is mentioned below.
Path:Â start > 2 > accept > accept > accept > accept.
Question: String baabbb can be ready by this Turing machine or not? If it can be read then what will be the path?
Answer: Sorry this string can’t be read by this Turing machine because this machine only can read the strings that are started with alphabet a.
Question: String aababb can be ready by this Turing machine or not? If it can be read then what will be the path?
Answer: Yes, this string can be read by the Turing machine in the Path of machine execution is mentioned below.
Path: start > 2 > 2 > accept > accept > accept.
Read More Examples of Turing Machine
- Turing Machine to copy a string: with animations
- Turing Machine of numbers divisible by 3: with animations
- Turing machine for anbncn: with animations
-
Turing machine of two equal binary strings: with animations
-
Turing Machine to Accepts palindromes: with animations
-
Turing machine for a’s followed by b’s then c’s where the number of a’s multiplied by the number of b’s and equals to the number of c’s: with animations
-
Turing machine to Add two binary numbers: with animations
- Turing machine to Multiply two unary numbers: with animations
- Turing machine to Multiply two binary numbers: with animations
- Turing Machine for the complement of a string
- Turing Machine for the language of anbn where a=b.
- Turing Machine for a is less than b, ambn where a=b or m=n.
-
Turing machine for the language of all those string in which a is less than b