![]() |
VOOZH | about |
Prerequisite - Pushdown Automata, Pushdown Automata Acceptance by Final State
A push down automata is similar to deterministic finite automata except that it has a few more properties than a DFA.The data structure used for implementing a PDA is stack. A PDA has an output associated with every input. All the inputs are either pushed into a stack or just ignored. User can perform the basic push and pop operations on the stack which is use for PDA. One of the problems associated with DFAs was that could not make a count of number of characters which were given input to the machine. This problem is avoided by PDA as it uses a stack which provides us this facility also.
A Pushdown Automata (PDA) can be defined as -
M = (Q, Σ, Γ, δ, q0, Ζ, F) where
Representation of State Transition -
Representation of Push in a PDA -
Representation of Pop in a PDA -
Representation of Ignore in a PDA -
Approach used in this PDA -
First 0's are pushed into stack. Then 1's are pushed into stack.
Then for every 2 as input a 1 is popped out of stack. If some 2's are still left and top of stack is a 0 then string is not accepted by the PDA. Thereafter if 2's are finished and top of stack is a 0 then for every 3 as input equal number of 0's are popped out of stack. If string is finished and stack is empty then string is accepted by the PDA otherwise not accepted.
Examples:
Input : 0 0 1 1 1 2 2 2 3 3 Result : ACCEPTED Input : 0 0 0 1 1 2 2 2 3 3 Result : NOT ACCEPTED
Approach used in this PDA -
First 0's are pushed into stack.When 0's are finished, two 1's are ignored. Thereafter for every 1 as input a 0 is popped out of stack. When stack is empty and still some 1's are left then all of them are ignored.
Examples:
Input : 0 0 0 1 1 1 1 1 1 Result : ACCEPTED Input : 0 0 0 0 1 1 1 1 Result : NOT ACCEPTED