Let $Sigma = {0,1}$ and $B$ is the collection of all strings that contain at least one $1$ in the second half. To state it more precisely: $B={uvmid u in Sigma^{ast}, v in Sigma^{ast} 1 Sigma^{ast}, |u|geq|v|}$. Give a PDA that recognizes $B$. Give a diagram to describe your PDA.
My question is why do I need a PDA or really a stack for this because all I am looking at is the second half which I can just epsilon to the second half and then when I read a $1$, go to the accept state. For example if $u=1001010101$ and $v=000011$, wouldnt I just loop around for a bit for u and then epsilon over to say I am now looking at $v$. Then when I read the first $1$, I just accept. I wouldnt need to use the stack at all would I? I’m not sure if I understand it correctly or not and would appreciate any help.
Asked By : user1715916
Answered By : Luke Mathieson
- As Babou points out in his answer, you don’t need a stack as such, a simple counter suffices, but you do need something beyond what a DFA/NFA can manage.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/35166