Construct a deterministic PDA for L = {w ∈ {a, b}* : na (w) = nb (w)}
Here we have 2 different paths to final state q3 since the starting symbol can be either a or b. Path from q0-q1-q3 is when starting symbol is a and path from q0-q2-q3 is when starting symbol is b.
In the q0-q1-q3 path, push all a's onto stack. And pop an 'a' when b occurs.
a, z|a -> Push a onto stack when stack is empty.
a, a|aa -> Push a onto stack when top element of stack is a.
Finally €, z|z means when we have reached to end of symbol and stack is empty, then go to state q3 which is final state. String which lead to state q3 are the string which are accepted by PDA
If you have any questions comment down. Please just don't simply downvote and leave. If you are satisfied with answer , please? upvote.. I really need it, thanks
Get Answers For Free
Most questions answered within 1 hours.