Ticker

6/recent/ticker-posts

Turing machine for a^nb^nc^n

 

In this turing machine number of a that equal to the number of b and c .pda cannot do this because in pda only one comparision is possible using stack so turing machine is used to count equal number of b and c.


When in state q0 if a is encounter convert into x and move right in tape and goto state q1. state q01 if b is encounter convert into y and move right in tape and goto state q2. state q2 if c is encounter convert into z and move right in tape and goto state q3. 



To check all the 'a's, 'b's and 'c's are over add loops for checking 'Y' and 'Z' after "we get 'X' followed by 'Y'"
To reach final state(qf) just replace BLANK with BLANK and move either direction.

For example

In state q0

aabbcc

a convert into x and reach on state q1

xabbcc

b convert into y and reach on state q2

xaybcc

c convert into z and reach on state q3

xaybzc

Now move on left without changing any symbol

Again reach on q0 and repeat same

xxyyzz

To check all the 'a's, 'b's and 'c's are over add loops for checking 'Y' and 'Z' after "we get 'X' followed by 'Y'"

To reach final state(qf) just replace BLANK with BLANK and move either direction.


Post a Comment

0 Comments