Difference Between NPDA and DPDA
Last Updated :
14 Feb, 2025
A Pushdown Automata (PDA) is a way to implement context-free Grammar in a similar way. We design Finite Automata for Regular Grammar.
- It is more powerful than FSM.
- FSM has very limited memory but PDA has more memory.
- PDA= Finite State Machine + Stack
This stack has infinite memory and that facilitates the higher power of Pushdown automata. This helps PDA to behave more powerful than Finite-state Machine.
A Pushdown Automata has three Components:
- An input tape
- A finite Control Unit.
- A stack with infinite size.
Definition of DPDA and NPDA with example
Let M = (Q,?,?,q0, Z,F ,?) be a PDA. The PDA is deterministic if and only if
- ?(q, a, Z) has one element.
- If ?(q, ?, Z) is non-empty, then ?(q, c, Z) should be empty for every c ? ? .
Both conditions should be satisfied for the PDA to be deterministic. If one of the conditions fails, the PDA is non-deterministic.
Let us consider an example to understand more clearly.
Example: Is the PDA corresponding to the language L = {anbn | n>=1} by the finite state is deterministic ?
Solution: The shown transitions defined for this machine are shown below:
?(q0, a, Z0) =?(q0, aZ0)
?(q0, a, a) =?(q0, aa)
?(q0, b, a) =?(q1, ?)
?(q1, b, a) =?(q1, ?)
?(q1, ?, Z0) =?(qf, ?)
The PDA should satisfy the two conditions. shown in the definition to be deterministic.
- ?(q0, a, Z0) has only one element. In this case, for each q?Q, a?? , and Z??, there exists only one definition so the first condition is satisfied.
- To satisfy the second condition consider the transition. ?(q1,? , Z0) = (qf,?,). Since the transition is defined, the transition ?(q, a, Z0) where a?? should not be defined which is true.
since both conditions. are satisfied, then the given PDA is deterministic.
Difference between NPDA and DPDA:
S. No | DPDA(Deterministic Pushdown Automata) | NPDA(Non-deterministic Pushdown Automata) |
---|
1. | It is less powerful than NPDA.
Example: We can only construct DPDA for odd-length palindromes and not for even length palindromes. | It is more powerful than DPDA.
Example: NPDA can be constructed for both even-length and odd-length palindromes. |
---|
2. | It is possible to convert every DPDA to a corresponding NPDA. | It is not possible to convert every NPDA to a corresponding DPDA. |
---|
3. | The language accepted by DPDA is a subset of the language accepted by NPDA. | The language accepted by NPDA is not a subset of the language accepted by DPDA. |
---|
4. | The language accepted by DPDA is called DCFL(Deterministic Context-free Language) which is a subset of NCFL(Non-deterministic Context-free Language) accepted by NPDA. | The language accepted by NPDA is called NCFL(Non-deterministic Context-free Language). |
---|
5. | There is only one state transition from one state to another state for an input symbol. | There may or maynot be more than one state transition from one state to another state for same input symbol. |
---|
There is one more difference as follows:
DPDA: For every input with the current state, there is only one move.
M = (Q,?,?,q0, Z,F ,?)
?: Q*?*??Q*?*
Deterministic pathNPDA: For every input with the current state, We can have multiple moves.
M = (Q,?,?,q0, Z,F ,?)
?: Q*{???}*??2Q*?*
Non- Deterministic pathWhy NPDA is more powerful than DPDA?
NDPA is more powerful than DPDA because we can add more transitions to it. It is possible for every language to add a transition. For some languages, we can construct DPDA there exist an NPDA but there are some languages that are accepted by NPDA but are not by DPDA. This is said to be powerful when it accepts more sets of languages than other automata.
In fact, it is more powerful than DFA(Deterministic finite automata) and NFA(Non-deterministic finite automata) also because, In the case of DFA and NFA, they are equivalent in power. So for every language accepted by DFA there exist an NFA and Vice-Versa. There is not any language for which we construct NFA but not DFA. Hence, we can't convert NPDA to DPDA always and we can convert NFA to equivalent DFA always.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Similar Reads
Difference between DMAIC and PDCA
1. DMAIC : Define, Measure, Analyze, Improve and Control in short referred as DMAIC. When it is fully implemented, ideates new process solution and problem solving approach. It is an improvement cycle which is a core tool used for driving six sigma rules. It makes the process easy for data driven cy
4 min read
Difference between FDMA and TDMA
FDMA stands for the Frequency Division Multiple Access. In the FDMA the available frequency range is split into the smaller bands. Each user gets their own frequency band to use. Its like having the different radio stations each station uses its own frequency so they dont interfere with each other.
4 min read
Difference between PDH and SDH
1. Plesiochronous Digital Hierarchy (PDH) : PDH stands for Plesiochronous Digital Hierarchy. It is a telecommunications network transmission technology designed for the transport of large data volumes across large-scale digital networks. In PDH, multiplexing of 2 Mbit/s signals into higher order mul
3 min read
Difference between MRP and DRP
1. Material Requirement Planning (MRP) : Developed in 1970s, raw material whenever required by any organization is managed i.e, which materials are required by company gets stored in a database. Also, it tells about shortage of any material. Material Requirement Planning is widely used approach for
2 min read
Difference between PPI and DPI
PPI (Pixels per Inch) and DPI (Dots per Inch) are both used to measure resolution but PPI is used for digital images, while DPI is more common in print. In this article, we will discuss the differences between PPI and DPI. PPI vs DPI What is PPI?PPI stands for Pixels Per Inch. PPI means the number o
5 min read
Difference Between RPA and WLA
Robotic Process Automation (RPA) and Workload Automation (WLA) are both major appliances that are used in businesses to automate processes and tasks. While they perform the same things, there are some key differences between the two, with unique advantages and disadvantages. Both technologies make w
5 min read
Difference between JPEG and PSD
1. Joint Photographic Expert Group (JPEG) : Since June 1982, Working Group 8 (WG8) of ISO has been working on standard for the compression and decompression of still images. In June 1987, ten different techniques for coding color and gray-scales still images were presented. An adaptive transformatio
2 min read
Difference between PCM and DPCM
When it comes to digital communication, two important techniques often come into play: In analog compression, we have Pulse Code Modulation (PCM) while Differential Pulse Code Modulation (DPCM is another kind of analog compression. These method are widely used for sampling the analog signals in to d
4 min read
Difference between DMAIC and DMADV
Prerequisite: Six Sigma in Software Engineering1. DMAIC :DMAIC is a part of the six sigma program which stands for Define, Measure, Analyze, Improve, and Control. DMAIC is a business strategy used to figure out how to improve processes while controlling costs. It's an effective way for identifying t
4 min read
Difference between DVR and NVR
1. Digital Video Recorder (DVR) : Digital Video Recorder (DVR) is mainly used for recording data from analog cameras or coaxial based cameras. It is paired with analog coax based cameras with resolution 2MP maximum. In this system both power cable and audio/video cable needed. It provides limited ra
3 min read