Give a push down Automata for this language: the length of is odd and it's middle symbol is 0

13.7k Views Asked by At

Give a push down automaton for this language:

{w| the length of w is odd and it's middle symbol is 0}

Here is the CFG I wrote for this language:

S --> 0|0S0|0s1|1s0|1s1

This what I have done for odd length part (I'm not using a stack for first part but I'm sure I need to use stack for second part):

enter image description here

I've spent days on this question but no luck,

1

There are 1 best solutions below

6
On BEST ANSWER

Broad Hint: You shouldn't have to check that the string has odd length. Note that a string $w$ is in the language $L$ described above iff there is an occurrence of the symbol $\mathtt{0}$ in $w$ such that there are exactly as many symbols in $w$ appearing before that occurrence of $\mathtt{0}$ as there are after. (For a hint that is a bit more direct, whenever you read a $\mathtt{0}$ from the string non-deterministically guess that this is the correct one, using the stack to check whether the above property holds.)