Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
66 views

Difference Between DFA and NFA

An ambiguous grammar is one that allows more than one leftmost or rightmost derivation for the same sentence. An example of an ambiguous grammar is provided. Finite automata are abstract machines that recognize patterns. A finite automaton has a finite set of states, input symbols, transitions between states depending on the input, an initial state, and final states. The differences between deterministic finite automata (DFA) and nondeterministic finite automata (NFA) are outlined.

Uploaded by

Cool Arvind
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

Difference Between DFA and NFA

An ambiguous grammar is one that allows more than one leftmost or rightmost derivation for the same sentence. An example of an ambiguous grammar is provided. Finite automata are abstract machines that recognize patterns. A finite automaton has a finite set of states, input symbols, transitions between states depending on the input, an initial state, and final states. The differences between deterministic finite automata (DFA) and nondeterministic finite automata (NFA) are outlined.

Uploaded by

Cool Arvind
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

what do you mean by ambiguity grammar give an example?

A Grammar that makes more than one Leftmost Derivation (or Rightmost Derivation) for the similar
sentence is called Ambiguous Grammar. Example − Verify whether the following Grammar is Ambiguous
or Not. E → E+E|E ∗ E|n
LMD1- E=E+E(USE E-N)
N+E(USE E-E*E)
N+E*E(USEE-N)
N+N*E(USE-N)
N+N*N

Finite Automata(FA) is the simplest machine to recognize patterns. The finite automata or
finite state machine is an abstract machine that has five elements or tuples. It has a set
of states and rules for moving from one state to another but it depends upon the applied
input symbol. Basically, it is an abstract model of a digital computer. The following figure
shows some essential features of general automation.
A Finite Automata consists of the following: Transaction of dfa and nfa
Q : Finite set of states.
Σ : set of Input Symbols.
q : Initial state.
F : set of Final States.
δ : Transition Function.
Operations on Regular Languages
 Union.
 Intersection.
 Difference.
 Concatenation.
 kleen * closure.

 Difference between DFA and NFA :

DFA NFA

NFA stands for Nondeterministic Finite


DFA stands for Deterministic Finite Automata. Automata.

For each symbolic representation of the alphabet, No need to specify how does the NFA react
there is only one state transition in DFA. according to some symbol.

DFA cannot use Empty String transition. NFA can use Empty String transition.
DFA NFA

NFA can be understood as multiple little


DFA can be understood as one machine. machines computing at the same time.

In NFA, each pair of state and input symbol


In DFA, the next possible state is distinctly set. can have many possible next states.

DFA is more difficult to construct. NFA is easier to construct.

DFA rejects the string in case it terminates in a NFA rejects the string in the event of all
state that is different from the accepting state. branches dying or refusing the string.

Time needed for executing an input string is


Time needed for executing an input string is less. more.

All DFA are NFA. Not all NFA are DFA.

DFA requires more space. NFA requires less space then DFA.

Dead state may be required. Dead state is not required.

δ: QxΣ -> 2^Q i.e. next possible state belongs


δ: QxΣ -> Q i.e. next possible state belongs to Q. to power set of Q.

Backtracking is allowed in DFA. Backtracking is not always possible in NFA.

Conversion of Regular expression to DFA is Conversion of Regular expression to NFA is


difficult. simpler compared to DFA.
Class of regular language is closed under union operation
A regular language is one which has an FA or an RE. Regular languages are closed under union,
concatenation, star, and complementation.

What is the formal definition of a DFA?


Deterministic finite automata (or DFA) are finite state machines that accept or reject strings of
characters by parsing them through a sequence that is uniquely determined by each string.
The term “deterministic” refers to the fact that each string, and thus each state sequence, is
unique.

What is formal definition of NFA?


NFA stands for non-deterministic finite automata. It is easy to construct an NFA when
compared to DFA for a given regular language. The finite automata are called NFA when there
exist many paths for specific input from the current state to the next state. Each NFA can be
translated into DFA but every NFA is Non DFA.
The pumping lemma is often used to prove that a particular language is non-regular: a proof by
contradiction may consist of exhibiting a string (of the required length) in the language that lacks the property
outlined in the pumping lemma.

You might also like