How can I design the following Turing machine concept? ( there was one 'L' look a like '1')
My attempt is given also, but it was not correct....
So it looks like you need a TM to recognize strings like this:
We need a strategy that ensures our TM can keep track of how many of each symbol there is. We can imagine a multi-tape solution would be pretty simple:
Rather than try to write down a multi-tape TM, let's go for a single-tape TM:
Here's a transition table:
q t q' t' d comment
-- --- -- -- ----- -------
q0 X q0 X right move right to find at least one Y
q0 Y q1 V left then cross it out and start looking for an X
q1 U,V q1 U,V left keep looking for an X to cross off
q1 X q2 U right cross off the X and start looking for more Y
q2 U,V q2 U,V right keep looking for more Y to cross off
q2 Y q1 V left we found another Y, cross off and keep going
q2 Z q3 Z left no more Y, start looking for last X
q3 U,V q3 U,V left keep looking for last X
q3 X q4 U left need to make sure this was the last one
q4 # q5 # right it was the last X, go check V & Z now
q5 U q5 U right skip the crossed off X (now U)
q5 V q5 Y right skip crossed off Y, and uncross back to Y
q5 Z q6 W left cross off a Z and start looking for V
q6 V,W q6 V,W left skip any crossed off Y/Z and look for Y
q6 Y q7 V right cross off Y, go look for more Z
q6 U q8 U right no more Y, ensure three uncrossed Z
q7 V,W q7 V,W right skip any crossed off Y/Z and look for Z
q7 Z q6 W left cross off another Z and start looking for Y
q8 V,W q8 V,W right skip any crossed off Y/Z and look for Z
q8 Z q9 W right found one Z, need two more
q9 Z qA W right found a second Z, need one more
qA Z qB W right found a third Z, need zero more
qB # hA # left no more Z, halt-accept