Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
39 views16 pages

PDA With Differentiate DPDA Vs NPDA

The document explains Pushdown Automata (PDA), which implement Context-Free Grammars and include a stack for memory. It differentiates between Deterministic PDA (DPDA) and Non-Deterministic PDA (NPDA), highlighting that DPDA has a single possible move while NPDA can have multiple moves and accepts all Context-Free Languages. Applications of PDA include checking balanced parentheses and recognizing context-free languages.

Uploaded by

nahimalumja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views16 pages

PDA With Differentiate DPDA Vs NPDA

The document explains Pushdown Automata (PDA), which implement Context-Free Grammars and include a stack for memory. It differentiates between Deterministic PDA (DPDA) and Non-Deterministic PDA (NPDA), highlighting that DPDA has a single possible move while NPDA can have multiple moves and accepts all Context-Free Languages. Applications of PDA include checking balanced parentheses and recognizing context-free languages.

Uploaded by

nahimalumja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

PDA with differentiate

DPDA vs NPDA
Presented by
Group- 6
PUSH DOWN AUTOMATA
• A Pushdown Automata (PDA) is a way to implement a Context-
Free Grammar in a similar manner to how we design Finite
Automata for a Regular Grammar.

• Pushdown automata are similar to Nondeterministic Finite


Automata, but they have an additional component called a
Stack.

• Recognizes Context-Free Languages (CFLs).

• More powerful than FA but less than a Turing Machine.


Formal Definition
Properties of Pushdown
Automata

• It is more powerful than Finite State Machine (FSA).

• FSA has a very limited memory but PDA has more


memory.

• PDA = Finite State Machine + Stack.


Stack
• A stack is a way we arrange elements one on top of
another.

• A stack does two basic operations:


1. PUSH: A new element is added at the top of
the stack.

2. POP: The top element of the stack is read


and removed.
Components of Pushdown
Automata

• An Input tape.
• A Finite Control Unit.
• A Stack with infinite
size.
Graphical Notation (PDA)
Example
DETERMINISTIC PDA
• DPDA (Deterministic Pushdown Automaton)
is a type of Pushdown Automaton (PDA)
where for every state, input symbol, and
top of stack, there is at most one possible
DPDA (Deterministic Pushdown Automaton) is a type of Pushdown Automaton (PDA) where for every state, input symbol, and top of
move. stack, there is at most one possible move

• At every step, only one possible move


• No ε-transitions that cause confusion
• Each combination of (state, input, stack
top) → at most one move
• Accepts deterministic CFLs (DCFLs)
EXAMPLE DPDA

q0 (Start + Final also, double circle):


Transition: (a, λ ->a) -> If input a, with nothing on stack (λ), push a.
Then move to q1.
q1:
(a, λ ->a) ->On input a, push an a on stack (keeps counting number of a’s).
(b, a-> λ) ->On input b, if top of stack has a, pop that a.
When b starts, machine moves to q2.
q2:
(b, a -> λ) ->For each b, pop one a.
When input finishes and only $ remains in stack, move to q3.
q3 (Final State):
(λ, $-> $)-> Accepts if stack has only bottom symbol left

This DPDA accepts L = { aⁿ bⁿ | n ≥ 1 } -> equal number of a’s followed by equal number of b’s.
NON-DETERMININSTIC PDA

• Can have multiple possible moves for the same


configuration
• Can use ε-transitions freely
• Accepts all CFLs
• More powerful than DPDA
EXAMPLE NPDA
Start in the initial state with the stack containing only the
bottom-of-stack marker, $.
• For each 'a' read, push an X onto the stack.
• When a 'b' is read, the machine non-deterministically
chooses one of two paths.

• If the 'b' is the center of the palindrome, transition to the


second state and begin popping.
• If the 'b' is part of the first half, continue pushing Xs onto
the stack.
• For each 'b' read after the center, pop an X from the
stack.
The string is accepted if and only if the machine reaches the
final state with an empty stack (meaning only the $ remains).
This signifies a perfect match between the first and second
halves of the palindrome.
DPDA VS NPDA

Feature DPDA NPDA

Determinism Only one move possible Multiple moves possible

ε-transitions Restricted / limited Freely allowed

Languages Deterministic CFLs (subset of


All CFLs
accepted CFLs)

Power Less powerful More powerful

Example a^nb^n Palindrome


APPLICAION OF PDA

• Checking balanced parentheses


• Recognizing context-free languages
• Natural language processing
Summary
• PDA = FA + Stack → accepts Context-Free Languages
(CFLs)
• DPDA → Deterministic, single move only, restricted ε-
transitions, accepts DCFLs
• NPDA → Non-deterministic, multiple moves, free ε-
transitions, accepts all CFLs
• Power: DPDA ⊂ NPDA (DPDA less powerful)
• Examples:
• DPDA → { aⁿbⁿ }
• NPDA → Palindromes
THANK YOU

You might also like