N.D.F.A TO D.F.A. CONVERSION
- Get link
- X
- Other Apps
Each transition leads to exactly one state called as deterministic | A transition leads to a subset of states i.e. some transitions can be non-deterministic. |
Accepts input if the last state is in Final | Accepts input if one of the last states is in Final. |
Backtracking is allowed in DFA. | Backtracking is not always possible. |
Requires more space. | Requires less space. |
Empty string transitions are not seen in DFA. | Permits empty string transition. |
For a given state, on a given input we reach a deterministic and unique state. | For a given state, on a given input we reach more than one state. |
DFA is a subset of NFA. | Need to convert NFA to DFA in the design of a compiler. |
δ : Q × Σ → Q For example − δ(q0,a)={q1} | δ : Q × Σ → 2Q For example − δ(q0,a)={q1,q2} |
DFA is more difficult to construct. | NFA is easier to construct. |
DFA is understood as one machine. | NFA is understood as multiple small machines computing at the same time. |
Step 1: Initially Q' = ϕ
Step 2: Add q0 of NFA to Q'. Then find the transitions from this start state
Step 3: In Q', find the possible set of states for each input symbol. If this set of states is not in Q', then add it to Q'.
Step 4: In DFA, the final state will be all the states which contain F(final states of NFA)
State / Alphabet | a | b |
→q0 | q0 | q0, q1 |
q1 | – | *q2 |
*q2 | – | – |
Step-01:
Let Q’ be a new set of states of the Deterministic Finite Automata (DFA).
Let T’ be a new transition table of the DFA.
Step-02:
Add transitions of start state q0 to the transition table T’.
State / Alphabet | a | b |
→q0 | q0 | {q0, q1} |
Step-03:
New state present in state Q’ is {q0, q1}.
Add transitions for set of states {q0, q1} to the transition table T’.
State / Alphabet | a | b |
→q0 | q0 | {q0, q1} |
{q0, q1} | q0 | {q0, q1, q2} |
Step-04:
New state present in state Q’ is {q0, q1, q2}.
Add transitions for set of states {q0, q1, q2} to the transition table T’.
State / Alphabet | a | b |
→q0 | q0 | {q0, q1} |
{q0, q1} | q0 | {q0, q1, q2} |
{q0, q1, q2} | q0 | {q0, q1, q2} |
Step-05:
Since no new states are left to be added in the transition table T’, so we stop.
States containing q2 as its component are treated as final states of the DFA.
Finally, Transition table for Deterministic Finite Automata (DFA) is-
State / Alphabet | a | b |
→q0 | q0 | {q0, q1} |
{q0, q1} | q0 | *{q0, q1, q2} |
*{q0, q1, q2} | q0 | *{q0, q1, q2} |
Now, Deterministic Finite Automata (DFA) may be drawn as-
- Get link
- X
- Other Apps
Comments
Post a Comment