Aspects


vs


Dfa

A DFA is a deterministic finite automaton, a simple model of computation

Nfa

An NFA is a nondeterministic finite automaton, a mathematical model of computation that decides membership in regular languages.

Faster compact powerful

Quality Example
Faster

"Generally speaking dfa is faster but nfa is more compact"

from question "Parallel regex matching with NFA vs DFA? Which one is faster?"

Slower

"Perl uses nfa which is slower yet more powerful than the dfa engine sed has"

from question "Is it faster to use alternation than subsequent replacements in regular expressions"

"Regex is a nfa and is as such in most cases slower than a dfa or hand-written parser"

from question "Rewrite IsHexString method with RegEx"

Others

Quality Example
More expressive

"The net effect is that the backtracking implementations i like that name better than traditional nfa are slightly more expressive than dfa implementations because they can match regexes like which matches three or more word characters repeated twice something that can t be matched by a dfa"

from question "If NFA and DFA were equivalent, why would we have two engines for regex?"

Larger

"If it can be practically determinized this give you a dfa that can be exponentially larger than the nfa then by all means do that"

from question "Match Regular expression from a dictionary in C#"

Typically more complex

"At the same time the compilation phase for a dfa is typically more complex than for an nfa and dfas don t have all the capabilities of nfas"

from question "How much faster are regular expressions processed in C/Java than in Python?"

Smaller

"In fact because you are eliminating the redundancy of epsilon transitions many simple dfa s actually get smaller than the nfa they represent but there is simply no way to guarantee that"

from question "DFA based regular expression matching - how to get all matches?"

Far easier

"Because representation of a given problem with a nfa is far easier than the equivalent dfa"

from question "Non-deterministic finite state machines in software development?"

More states

"If we express combinations of states in an nfa as states themselves we ve got a dfa with a lot more states than the nfa but which does the same thing"

from question "DFA vs NFA engines: What is the difference in their capabilities and limitations?"

Better choice

"Dfa is a better choice over nfa because it has only one transition for an input while nfa can have many"

from question "Parallel regex matching with NFA vs DFA? Which one is faster?"

Back to Home
Data comes from Stack Exchange with CC-BY-SA-3.0