2

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

xskxzr
  • 7,455
  • 5
  • 23
  • 46
Devy
  • 123
  • 2

1 Answers1

0

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.

Evil
  • 9,455
  • 11
  • 31
  • 52