Difference between NFA and DFA
$begingroup$
In very simple terms please, all resources I'm finding are talking about tuples and stuff and I just need a simple explanation that I can remember easily because I keep getting them mixed up.
automata
$endgroup$
add a comment |
$begingroup$
In very simple terms please, all resources I'm finding are talking about tuples and stuff and I just need a simple explanation that I can remember easily because I keep getting them mixed up.
automata
$endgroup$
4
$begingroup$
N = nondeterministic, D = deterministic. What aspects are you confusing about automata? Ignore the tuples: they're a low-level representation meant for proving things and making precise statements, not for human intuition.
$endgroup$
– Hurkyl
Nov 12 '13 at 13:16
add a comment |
$begingroup$
In very simple terms please, all resources I'm finding are talking about tuples and stuff and I just need a simple explanation that I can remember easily because I keep getting them mixed up.
automata
$endgroup$
In very simple terms please, all resources I'm finding are talking about tuples and stuff and I just need a simple explanation that I can remember easily because I keep getting them mixed up.
automata
automata
asked Nov 12 '13 at 13:11
OgenOgen
87931829
87931829
4
$begingroup$
N = nondeterministic, D = deterministic. What aspects are you confusing about automata? Ignore the tuples: they're a low-level representation meant for proving things and making precise statements, not for human intuition.
$endgroup$
– Hurkyl
Nov 12 '13 at 13:16
add a comment |
4
$begingroup$
N = nondeterministic, D = deterministic. What aspects are you confusing about automata? Ignore the tuples: they're a low-level representation meant for proving things and making precise statements, not for human intuition.
$endgroup$
– Hurkyl
Nov 12 '13 at 13:16
4
4
$begingroup$
N = nondeterministic, D = deterministic. What aspects are you confusing about automata? Ignore the tuples: they're a low-level representation meant for proving things and making precise statements, not for human intuition.
$endgroup$
– Hurkyl
Nov 12 '13 at 13:16
$begingroup$
N = nondeterministic, D = deterministic. What aspects are you confusing about automata? Ignore the tuples: they're a low-level representation meant for proving things and making precise statements, not for human intuition.
$endgroup$
– Hurkyl
Nov 12 '13 at 13:16
add a comment |
4 Answers
4
active
oldest
votes
$begingroup$
Each input to a DFA or NFA affects the state of the automaton: if it was in state $q$ immediately before the input, either it will be in some state $q'$ after the input, or the input will cause it to choke. (Note that $q'$ may be the same as $q$.) Suppose that we have an automaton in a state $q$. The difference in behavior between a DFA and an NFA is this:
If it’s a DFA, each possible input determines the resulting state $q'$ uniquely. Every input causes a state change, and the new state is completely determined by the input. Moreover, the automaton can change state only after reading an input.
If it’s an NFA, some inputs may allow a choice of resulting states, and some may cause the automaton to choke, because there is no new state corresponding to that input. Moreover, the automaton may be constructed so that it can change state to some new state $q'$ without reading any input at all.
As a consequence of this difference in behavior, DFA’s and NFA’s differ in another very important respect.
If you start a DFA in its initial state and input some word $w$, the state $q$ in which the DFA ends up is completely determined by $w$: inputting $w$ to the DFA will always cause it to end up in state $q$. This is what is meant by calling it deterministic.
If you start an NFA in its initial state and input some word $w$, there may be several possible states in which it can end up, since some of the inputs along the way may have allowed a choice of state changes. Consequently, you can’t predict from $w$ alone in exactly which state the automaton will finish; this is what is meant by calling it nondeterministic. (And it’s actually a little worse than I’ve indicated, since an NFA is also allowed to have more than one initial state.)
Finally, these differences affect how we determine what words are accepted (or recognized) by an automaton.
If it’s a DFA, we know that each word completely determines the final state of the automaton, and we say that the word is accepted if that state is an acceptor state.
If it’s an NFA, there might be several possible final states that could result from reading a given word; as long as at least one of them is an acceptor state, we say that the automaton accepts the word.
What I’ve described informally is the view of an NFA that makes it look most like a DFA and that I think best explains why it’s called nondeterministic. There is, however, another way of looking at NFAs: it’s also possible to think of an NFA as being in multiple states at once, as if it were making all possible choices at each input. If you think of it in those terms, you can say that it accepts a word provided that at least one of the states in which it ends up after reading that word is an acceptor state. This point of view is perhaps most useful for understanding the algorithm used to turn an NFA into an equivalent DFA.
$endgroup$
$begingroup$
Thanks for the detailed reply. You say that a non-deterministic finite automation can change state without reading any input at all, does that mean that a deterministic finite automation HAS TO have every possible transition at every state? (Because I'm assuming they're opposite).
$endgroup$
– Ogen
Nov 13 '13 at 2:38
1
$begingroup$
@Clay: Yes, at each state a DFA must have a transition for each symbol in the input alphabet. It cannot have any $epsilon$ transition, however (transitions with no input).
$endgroup$
– Brian M. Scott
Nov 13 '13 at 10:51
2
$begingroup$
Can you clarify what you mean by choke the NFA. Do you mean link to the same state, or unsuccessful completion of the NFA?
$endgroup$
– Andrew S
Mar 15 '14 at 6:32
$begingroup$
I think all that is missing on this answer is Construction Complexity and Execution Complexity comparison. Nicely written.
$endgroup$
– Fawar
Mar 5 '15 at 17:08
add a comment |
$begingroup$
Automata are abstract machines that have a finite set of states. Given some input, they transition from state to state. You can think of them sort of like flowcharts.
An NFA is a Nondeterministic Finite Automaton. Nondeterministic means it can transition to, and be in, multiple states at once (i.e. for some given input).
A DFA is a Deterministic Finite Automaton. Deterministic means that it can only be in, and transition to, one state at a time (i.e. for some given input).
The major important difference is that an NFA is usually much more efficient.
$endgroup$
8
$begingroup$
"NFA is usually much more efficient." In what way is it more efficient? Construction time? Execution time? Space used? Why?
$endgroup$
– Kevin Wheeler
Aug 24 '15 at 4:53
add a comment |
$begingroup$
For Every symbol of the alphabet, there is only one state transition in DFA.
We do not need to specify how does the NFA react according to some symbol.
DFA cannot use Empty String transition.
NFA can use Empty String transition.
DFA can be understood as one machine.
NFA can be understood as multiple little machines computing at the same time.
DFA will reject the string if it end at other than accepting state.
If all of the branches of NFA dies or rejects the string, we can say that NFA reject the string.
$endgroup$
add a comment |
$begingroup$
1.“DFA” stands for “Deterministic Finite Automata”, while “NFA” stands for “Nondeterministic Finite Automata.”
2.Both are transition functions of automata. In DFA the next possible state is distinctly a set, while in NFA each pair of state and input symbol can have many possible next states.
3.NFA can use empty string transition, while DFA cannot use empty string transition.
4.NFA is easier to construct, while it is more difficult to construct DFA.
5.Backtracking is allowed in DFA, while in NFA it may or may not be allowed.
6.DFA requires more space, while NFA requires less space.
7.While DFA can be understood as one machine and a DFA machine can be constructed for every input and output, NFA can be understood as several little machines that compute together, and there is no possibility of constructing an NFA machine for every input and output.
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f563829%2fdifference-between-nfa-and-dfa%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Each input to a DFA or NFA affects the state of the automaton: if it was in state $q$ immediately before the input, either it will be in some state $q'$ after the input, or the input will cause it to choke. (Note that $q'$ may be the same as $q$.) Suppose that we have an automaton in a state $q$. The difference in behavior between a DFA and an NFA is this:
If it’s a DFA, each possible input determines the resulting state $q'$ uniquely. Every input causes a state change, and the new state is completely determined by the input. Moreover, the automaton can change state only after reading an input.
If it’s an NFA, some inputs may allow a choice of resulting states, and some may cause the automaton to choke, because there is no new state corresponding to that input. Moreover, the automaton may be constructed so that it can change state to some new state $q'$ without reading any input at all.
As a consequence of this difference in behavior, DFA’s and NFA’s differ in another very important respect.
If you start a DFA in its initial state and input some word $w$, the state $q$ in which the DFA ends up is completely determined by $w$: inputting $w$ to the DFA will always cause it to end up in state $q$. This is what is meant by calling it deterministic.
If you start an NFA in its initial state and input some word $w$, there may be several possible states in which it can end up, since some of the inputs along the way may have allowed a choice of state changes. Consequently, you can’t predict from $w$ alone in exactly which state the automaton will finish; this is what is meant by calling it nondeterministic. (And it’s actually a little worse than I’ve indicated, since an NFA is also allowed to have more than one initial state.)
Finally, these differences affect how we determine what words are accepted (or recognized) by an automaton.
If it’s a DFA, we know that each word completely determines the final state of the automaton, and we say that the word is accepted if that state is an acceptor state.
If it’s an NFA, there might be several possible final states that could result from reading a given word; as long as at least one of them is an acceptor state, we say that the automaton accepts the word.
What I’ve described informally is the view of an NFA that makes it look most like a DFA and that I think best explains why it’s called nondeterministic. There is, however, another way of looking at NFAs: it’s also possible to think of an NFA as being in multiple states at once, as if it were making all possible choices at each input. If you think of it in those terms, you can say that it accepts a word provided that at least one of the states in which it ends up after reading that word is an acceptor state. This point of view is perhaps most useful for understanding the algorithm used to turn an NFA into an equivalent DFA.
$endgroup$
$begingroup$
Thanks for the detailed reply. You say that a non-deterministic finite automation can change state without reading any input at all, does that mean that a deterministic finite automation HAS TO have every possible transition at every state? (Because I'm assuming they're opposite).
$endgroup$
– Ogen
Nov 13 '13 at 2:38
1
$begingroup$
@Clay: Yes, at each state a DFA must have a transition for each symbol in the input alphabet. It cannot have any $epsilon$ transition, however (transitions with no input).
$endgroup$
– Brian M. Scott
Nov 13 '13 at 10:51
2
$begingroup$
Can you clarify what you mean by choke the NFA. Do you mean link to the same state, or unsuccessful completion of the NFA?
$endgroup$
– Andrew S
Mar 15 '14 at 6:32
$begingroup$
I think all that is missing on this answer is Construction Complexity and Execution Complexity comparison. Nicely written.
$endgroup$
– Fawar
Mar 5 '15 at 17:08
add a comment |
$begingroup$
Each input to a DFA or NFA affects the state of the automaton: if it was in state $q$ immediately before the input, either it will be in some state $q'$ after the input, or the input will cause it to choke. (Note that $q'$ may be the same as $q$.) Suppose that we have an automaton in a state $q$. The difference in behavior between a DFA and an NFA is this:
If it’s a DFA, each possible input determines the resulting state $q'$ uniquely. Every input causes a state change, and the new state is completely determined by the input. Moreover, the automaton can change state only after reading an input.
If it’s an NFA, some inputs may allow a choice of resulting states, and some may cause the automaton to choke, because there is no new state corresponding to that input. Moreover, the automaton may be constructed so that it can change state to some new state $q'$ without reading any input at all.
As a consequence of this difference in behavior, DFA’s and NFA’s differ in another very important respect.
If you start a DFA in its initial state and input some word $w$, the state $q$ in which the DFA ends up is completely determined by $w$: inputting $w$ to the DFA will always cause it to end up in state $q$. This is what is meant by calling it deterministic.
If you start an NFA in its initial state and input some word $w$, there may be several possible states in which it can end up, since some of the inputs along the way may have allowed a choice of state changes. Consequently, you can’t predict from $w$ alone in exactly which state the automaton will finish; this is what is meant by calling it nondeterministic. (And it’s actually a little worse than I’ve indicated, since an NFA is also allowed to have more than one initial state.)
Finally, these differences affect how we determine what words are accepted (or recognized) by an automaton.
If it’s a DFA, we know that each word completely determines the final state of the automaton, and we say that the word is accepted if that state is an acceptor state.
If it’s an NFA, there might be several possible final states that could result from reading a given word; as long as at least one of them is an acceptor state, we say that the automaton accepts the word.
What I’ve described informally is the view of an NFA that makes it look most like a DFA and that I think best explains why it’s called nondeterministic. There is, however, another way of looking at NFAs: it’s also possible to think of an NFA as being in multiple states at once, as if it were making all possible choices at each input. If you think of it in those terms, you can say that it accepts a word provided that at least one of the states in which it ends up after reading that word is an acceptor state. This point of view is perhaps most useful for understanding the algorithm used to turn an NFA into an equivalent DFA.
$endgroup$
$begingroup$
Thanks for the detailed reply. You say that a non-deterministic finite automation can change state without reading any input at all, does that mean that a deterministic finite automation HAS TO have every possible transition at every state? (Because I'm assuming they're opposite).
$endgroup$
– Ogen
Nov 13 '13 at 2:38
1
$begingroup$
@Clay: Yes, at each state a DFA must have a transition for each symbol in the input alphabet. It cannot have any $epsilon$ transition, however (transitions with no input).
$endgroup$
– Brian M. Scott
Nov 13 '13 at 10:51
2
$begingroup$
Can you clarify what you mean by choke the NFA. Do you mean link to the same state, or unsuccessful completion of the NFA?
$endgroup$
– Andrew S
Mar 15 '14 at 6:32
$begingroup$
I think all that is missing on this answer is Construction Complexity and Execution Complexity comparison. Nicely written.
$endgroup$
– Fawar
Mar 5 '15 at 17:08
add a comment |
$begingroup$
Each input to a DFA or NFA affects the state of the automaton: if it was in state $q$ immediately before the input, either it will be in some state $q'$ after the input, or the input will cause it to choke. (Note that $q'$ may be the same as $q$.) Suppose that we have an automaton in a state $q$. The difference in behavior between a DFA and an NFA is this:
If it’s a DFA, each possible input determines the resulting state $q'$ uniquely. Every input causes a state change, and the new state is completely determined by the input. Moreover, the automaton can change state only after reading an input.
If it’s an NFA, some inputs may allow a choice of resulting states, and some may cause the automaton to choke, because there is no new state corresponding to that input. Moreover, the automaton may be constructed so that it can change state to some new state $q'$ without reading any input at all.
As a consequence of this difference in behavior, DFA’s and NFA’s differ in another very important respect.
If you start a DFA in its initial state and input some word $w$, the state $q$ in which the DFA ends up is completely determined by $w$: inputting $w$ to the DFA will always cause it to end up in state $q$. This is what is meant by calling it deterministic.
If you start an NFA in its initial state and input some word $w$, there may be several possible states in which it can end up, since some of the inputs along the way may have allowed a choice of state changes. Consequently, you can’t predict from $w$ alone in exactly which state the automaton will finish; this is what is meant by calling it nondeterministic. (And it’s actually a little worse than I’ve indicated, since an NFA is also allowed to have more than one initial state.)
Finally, these differences affect how we determine what words are accepted (or recognized) by an automaton.
If it’s a DFA, we know that each word completely determines the final state of the automaton, and we say that the word is accepted if that state is an acceptor state.
If it’s an NFA, there might be several possible final states that could result from reading a given word; as long as at least one of them is an acceptor state, we say that the automaton accepts the word.
What I’ve described informally is the view of an NFA that makes it look most like a DFA and that I think best explains why it’s called nondeterministic. There is, however, another way of looking at NFAs: it’s also possible to think of an NFA as being in multiple states at once, as if it were making all possible choices at each input. If you think of it in those terms, you can say that it accepts a word provided that at least one of the states in which it ends up after reading that word is an acceptor state. This point of view is perhaps most useful for understanding the algorithm used to turn an NFA into an equivalent DFA.
$endgroup$
Each input to a DFA or NFA affects the state of the automaton: if it was in state $q$ immediately before the input, either it will be in some state $q'$ after the input, or the input will cause it to choke. (Note that $q'$ may be the same as $q$.) Suppose that we have an automaton in a state $q$. The difference in behavior between a DFA and an NFA is this:
If it’s a DFA, each possible input determines the resulting state $q'$ uniquely. Every input causes a state change, and the new state is completely determined by the input. Moreover, the automaton can change state only after reading an input.
If it’s an NFA, some inputs may allow a choice of resulting states, and some may cause the automaton to choke, because there is no new state corresponding to that input. Moreover, the automaton may be constructed so that it can change state to some new state $q'$ without reading any input at all.
As a consequence of this difference in behavior, DFA’s and NFA’s differ in another very important respect.
If you start a DFA in its initial state and input some word $w$, the state $q$ in which the DFA ends up is completely determined by $w$: inputting $w$ to the DFA will always cause it to end up in state $q$. This is what is meant by calling it deterministic.
If you start an NFA in its initial state and input some word $w$, there may be several possible states in which it can end up, since some of the inputs along the way may have allowed a choice of state changes. Consequently, you can’t predict from $w$ alone in exactly which state the automaton will finish; this is what is meant by calling it nondeterministic. (And it’s actually a little worse than I’ve indicated, since an NFA is also allowed to have more than one initial state.)
Finally, these differences affect how we determine what words are accepted (or recognized) by an automaton.
If it’s a DFA, we know that each word completely determines the final state of the automaton, and we say that the word is accepted if that state is an acceptor state.
If it’s an NFA, there might be several possible final states that could result from reading a given word; as long as at least one of them is an acceptor state, we say that the automaton accepts the word.
What I’ve described informally is the view of an NFA that makes it look most like a DFA and that I think best explains why it’s called nondeterministic. There is, however, another way of looking at NFAs: it’s also possible to think of an NFA as being in multiple states at once, as if it were making all possible choices at each input. If you think of it in those terms, you can say that it accepts a word provided that at least one of the states in which it ends up after reading that word is an acceptor state. This point of view is perhaps most useful for understanding the algorithm used to turn an NFA into an equivalent DFA.
answered Nov 12 '13 at 13:51
Brian M. ScottBrian M. Scott
457k38509909
457k38509909
$begingroup$
Thanks for the detailed reply. You say that a non-deterministic finite automation can change state without reading any input at all, does that mean that a deterministic finite automation HAS TO have every possible transition at every state? (Because I'm assuming they're opposite).
$endgroup$
– Ogen
Nov 13 '13 at 2:38
1
$begingroup$
@Clay: Yes, at each state a DFA must have a transition for each symbol in the input alphabet. It cannot have any $epsilon$ transition, however (transitions with no input).
$endgroup$
– Brian M. Scott
Nov 13 '13 at 10:51
2
$begingroup$
Can you clarify what you mean by choke the NFA. Do you mean link to the same state, or unsuccessful completion of the NFA?
$endgroup$
– Andrew S
Mar 15 '14 at 6:32
$begingroup$
I think all that is missing on this answer is Construction Complexity and Execution Complexity comparison. Nicely written.
$endgroup$
– Fawar
Mar 5 '15 at 17:08
add a comment |
$begingroup$
Thanks for the detailed reply. You say that a non-deterministic finite automation can change state without reading any input at all, does that mean that a deterministic finite automation HAS TO have every possible transition at every state? (Because I'm assuming they're opposite).
$endgroup$
– Ogen
Nov 13 '13 at 2:38
1
$begingroup$
@Clay: Yes, at each state a DFA must have a transition for each symbol in the input alphabet. It cannot have any $epsilon$ transition, however (transitions with no input).
$endgroup$
– Brian M. Scott
Nov 13 '13 at 10:51
2
$begingroup$
Can you clarify what you mean by choke the NFA. Do you mean link to the same state, or unsuccessful completion of the NFA?
$endgroup$
– Andrew S
Mar 15 '14 at 6:32
$begingroup$
I think all that is missing on this answer is Construction Complexity and Execution Complexity comparison. Nicely written.
$endgroup$
– Fawar
Mar 5 '15 at 17:08
$begingroup$
Thanks for the detailed reply. You say that a non-deterministic finite automation can change state without reading any input at all, does that mean that a deterministic finite automation HAS TO have every possible transition at every state? (Because I'm assuming they're opposite).
$endgroup$
– Ogen
Nov 13 '13 at 2:38
$begingroup$
Thanks for the detailed reply. You say that a non-deterministic finite automation can change state without reading any input at all, does that mean that a deterministic finite automation HAS TO have every possible transition at every state? (Because I'm assuming they're opposite).
$endgroup$
– Ogen
Nov 13 '13 at 2:38
1
1
$begingroup$
@Clay: Yes, at each state a DFA must have a transition for each symbol in the input alphabet. It cannot have any $epsilon$ transition, however (transitions with no input).
$endgroup$
– Brian M. Scott
Nov 13 '13 at 10:51
$begingroup$
@Clay: Yes, at each state a DFA must have a transition for each symbol in the input alphabet. It cannot have any $epsilon$ transition, however (transitions with no input).
$endgroup$
– Brian M. Scott
Nov 13 '13 at 10:51
2
2
$begingroup$
Can you clarify what you mean by choke the NFA. Do you mean link to the same state, or unsuccessful completion of the NFA?
$endgroup$
– Andrew S
Mar 15 '14 at 6:32
$begingroup$
Can you clarify what you mean by choke the NFA. Do you mean link to the same state, or unsuccessful completion of the NFA?
$endgroup$
– Andrew S
Mar 15 '14 at 6:32
$begingroup$
I think all that is missing on this answer is Construction Complexity and Execution Complexity comparison. Nicely written.
$endgroup$
– Fawar
Mar 5 '15 at 17:08
$begingroup$
I think all that is missing on this answer is Construction Complexity and Execution Complexity comparison. Nicely written.
$endgroup$
– Fawar
Mar 5 '15 at 17:08
add a comment |
$begingroup$
Automata are abstract machines that have a finite set of states. Given some input, they transition from state to state. You can think of them sort of like flowcharts.
An NFA is a Nondeterministic Finite Automaton. Nondeterministic means it can transition to, and be in, multiple states at once (i.e. for some given input).
A DFA is a Deterministic Finite Automaton. Deterministic means that it can only be in, and transition to, one state at a time (i.e. for some given input).
The major important difference is that an NFA is usually much more efficient.
$endgroup$
8
$begingroup$
"NFA is usually much more efficient." In what way is it more efficient? Construction time? Execution time? Space used? Why?
$endgroup$
– Kevin Wheeler
Aug 24 '15 at 4:53
add a comment |
$begingroup$
Automata are abstract machines that have a finite set of states. Given some input, they transition from state to state. You can think of them sort of like flowcharts.
An NFA is a Nondeterministic Finite Automaton. Nondeterministic means it can transition to, and be in, multiple states at once (i.e. for some given input).
A DFA is a Deterministic Finite Automaton. Deterministic means that it can only be in, and transition to, one state at a time (i.e. for some given input).
The major important difference is that an NFA is usually much more efficient.
$endgroup$
8
$begingroup$
"NFA is usually much more efficient." In what way is it more efficient? Construction time? Execution time? Space used? Why?
$endgroup$
– Kevin Wheeler
Aug 24 '15 at 4:53
add a comment |
$begingroup$
Automata are abstract machines that have a finite set of states. Given some input, they transition from state to state. You can think of them sort of like flowcharts.
An NFA is a Nondeterministic Finite Automaton. Nondeterministic means it can transition to, and be in, multiple states at once (i.e. for some given input).
A DFA is a Deterministic Finite Automaton. Deterministic means that it can only be in, and transition to, one state at a time (i.e. for some given input).
The major important difference is that an NFA is usually much more efficient.
$endgroup$
Automata are abstract machines that have a finite set of states. Given some input, they transition from state to state. You can think of them sort of like flowcharts.
An NFA is a Nondeterministic Finite Automaton. Nondeterministic means it can transition to, and be in, multiple states at once (i.e. for some given input).
A DFA is a Deterministic Finite Automaton. Deterministic means that it can only be in, and transition to, one state at a time (i.e. for some given input).
The major important difference is that an NFA is usually much more efficient.
answered Nov 12 '13 at 13:19
NewbNewb
13.4k93779
13.4k93779
8
$begingroup$
"NFA is usually much more efficient." In what way is it more efficient? Construction time? Execution time? Space used? Why?
$endgroup$
– Kevin Wheeler
Aug 24 '15 at 4:53
add a comment |
8
$begingroup$
"NFA is usually much more efficient." In what way is it more efficient? Construction time? Execution time? Space used? Why?
$endgroup$
– Kevin Wheeler
Aug 24 '15 at 4:53
8
8
$begingroup$
"NFA is usually much more efficient." In what way is it more efficient? Construction time? Execution time? Space used? Why?
$endgroup$
– Kevin Wheeler
Aug 24 '15 at 4:53
$begingroup$
"NFA is usually much more efficient." In what way is it more efficient? Construction time? Execution time? Space used? Why?
$endgroup$
– Kevin Wheeler
Aug 24 '15 at 4:53
add a comment |
$begingroup$
For Every symbol of the alphabet, there is only one state transition in DFA.
We do not need to specify how does the NFA react according to some symbol.
DFA cannot use Empty String transition.
NFA can use Empty String transition.
DFA can be understood as one machine.
NFA can be understood as multiple little machines computing at the same time.
DFA will reject the string if it end at other than accepting state.
If all of the branches of NFA dies or rejects the string, we can say that NFA reject the string.
$endgroup$
add a comment |
$begingroup$
For Every symbol of the alphabet, there is only one state transition in DFA.
We do not need to specify how does the NFA react according to some symbol.
DFA cannot use Empty String transition.
NFA can use Empty String transition.
DFA can be understood as one machine.
NFA can be understood as multiple little machines computing at the same time.
DFA will reject the string if it end at other than accepting state.
If all of the branches of NFA dies or rejects the string, we can say that NFA reject the string.
$endgroup$
add a comment |
$begingroup$
For Every symbol of the alphabet, there is only one state transition in DFA.
We do not need to specify how does the NFA react according to some symbol.
DFA cannot use Empty String transition.
NFA can use Empty String transition.
DFA can be understood as one machine.
NFA can be understood as multiple little machines computing at the same time.
DFA will reject the string if it end at other than accepting state.
If all of the branches of NFA dies or rejects the string, we can say that NFA reject the string.
$endgroup$
For Every symbol of the alphabet, there is only one state transition in DFA.
We do not need to specify how does the NFA react according to some symbol.
DFA cannot use Empty String transition.
NFA can use Empty String transition.
DFA can be understood as one machine.
NFA can be understood as multiple little machines computing at the same time.
DFA will reject the string if it end at other than accepting state.
If all of the branches of NFA dies or rejects the string, we can say that NFA reject the string.
edited Apr 27 '16 at 14:54
0x6773
1035
1035
answered Oct 12 '14 at 12:54
jigrmjigrm
6111
6111
add a comment |
add a comment |
$begingroup$
1.“DFA” stands for “Deterministic Finite Automata”, while “NFA” stands for “Nondeterministic Finite Automata.”
2.Both are transition functions of automata. In DFA the next possible state is distinctly a set, while in NFA each pair of state and input symbol can have many possible next states.
3.NFA can use empty string transition, while DFA cannot use empty string transition.
4.NFA is easier to construct, while it is more difficult to construct DFA.
5.Backtracking is allowed in DFA, while in NFA it may or may not be allowed.
6.DFA requires more space, while NFA requires less space.
7.While DFA can be understood as one machine and a DFA machine can be constructed for every input and output, NFA can be understood as several little machines that compute together, and there is no possibility of constructing an NFA machine for every input and output.
$endgroup$
add a comment |
$begingroup$
1.“DFA” stands for “Deterministic Finite Automata”, while “NFA” stands for “Nondeterministic Finite Automata.”
2.Both are transition functions of automata. In DFA the next possible state is distinctly a set, while in NFA each pair of state and input symbol can have many possible next states.
3.NFA can use empty string transition, while DFA cannot use empty string transition.
4.NFA is easier to construct, while it is more difficult to construct DFA.
5.Backtracking is allowed in DFA, while in NFA it may or may not be allowed.
6.DFA requires more space, while NFA requires less space.
7.While DFA can be understood as one machine and a DFA machine can be constructed for every input and output, NFA can be understood as several little machines that compute together, and there is no possibility of constructing an NFA machine for every input and output.
$endgroup$
add a comment |
$begingroup$
1.“DFA” stands for “Deterministic Finite Automata”, while “NFA” stands for “Nondeterministic Finite Automata.”
2.Both are transition functions of automata. In DFA the next possible state is distinctly a set, while in NFA each pair of state and input symbol can have many possible next states.
3.NFA can use empty string transition, while DFA cannot use empty string transition.
4.NFA is easier to construct, while it is more difficult to construct DFA.
5.Backtracking is allowed in DFA, while in NFA it may or may not be allowed.
6.DFA requires more space, while NFA requires less space.
7.While DFA can be understood as one machine and a DFA machine can be constructed for every input and output, NFA can be understood as several little machines that compute together, and there is no possibility of constructing an NFA machine for every input and output.
$endgroup$
1.“DFA” stands for “Deterministic Finite Automata”, while “NFA” stands for “Nondeterministic Finite Automata.”
2.Both are transition functions of automata. In DFA the next possible state is distinctly a set, while in NFA each pair of state and input symbol can have many possible next states.
3.NFA can use empty string transition, while DFA cannot use empty string transition.
4.NFA is easier to construct, while it is more difficult to construct DFA.
5.Backtracking is allowed in DFA, while in NFA it may or may not be allowed.
6.DFA requires more space, while NFA requires less space.
7.While DFA can be understood as one machine and a DFA machine can be constructed for every input and output, NFA can be understood as several little machines that compute together, and there is no possibility of constructing an NFA machine for every input and output.
edited Jan 14 at 2:11
amWhy
1
1
answered Jan 23 '16 at 15:47
NiraNira
211
211
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f563829%2fdifference-between-nfa-and-dfa%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
$begingroup$
N = nondeterministic, D = deterministic. What aspects are you confusing about automata? Ignore the tuples: they're a low-level representation meant for proving things and making precise statements, not for human intuition.
$endgroup$
– Hurkyl
Nov 12 '13 at 13:16