2
$\begingroup$

Need idea for solving the following pushdown automata:

$\mathcal{L}=\{w\in\sum ^* | \#a(w)=\#b(w),|w|\geqslant 0\} \,\,\,\, \sum=\{a,b\}$

In the beginning I thought to PUSH A for input a, and then to POP A for input b, but it doesn't work well for the word ba for example

$\endgroup$
0
$\begingroup$

You have solved half of the task. Now push $B$ for $b$ and pop $B$ for $a$.
To decide which operation to do, handle empty stack, pushing symbol when it is empty and popping otherwise.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.