PDA: Symbol in first half

241 Views Asked by At

How do I construct a PDA where:

$L = \{w \in \{0, 1\} ∗ : |w| \text{ is even and } w \text{ contains at least one 1-Symbol in the first Half}\}$

To me it seems impossible to know when I reached the midpoint.

1

There are 1 best solutions below

0
On BEST ANSWER

So this is my solution: PDA

I just stack 1s until I find the first 1-Symbol, then I pop them to see if the first 1 was in the first or second half and then I just make sure that the word is even.