How to convert this NFA to DFA?

1.3k Views Asked by At

enter image description here

What are the steps for converting this NFA to a DFA??

2

There are 2 best solutions below

0
On

Start with making a table that describes the "moves" of the NFA. One row for each state and one column for each input symbol. Then in each sell $(i,j)$ you write the states in which the NFA goes to when it is at the state of row $i$ and reads the symbol of column $j$. For example, when it is in state $0$ and reads $a$, it will go to states $0$ and $1$. \begin{matrix} \text{state} && a && b \\ \hline 0 && 0,1 && 0,2\\ 1 && - && 2\\ 2 && 1 && - \end{matrix} Then, for each set of states at which the NFA goes, you make a new row at the table and fill the new cells. \begin{matrix} \text{state} && a && b \\ \hline 0 && 0,1 && 0,2\\ 1 && - && 2\\ 2 && 1 && -\\ 0,1 && 0,1 && 0,2\\ 0,2 && 0,1 &&0,2 \end{matrix} So, your DFA has states $Q=\{0,\{0,1\},\{0,2\}\}$. You can make it look better if you rename the states and put $q_0=0$ (which is the starting state), $q_1=\{0,1\}$ and $q_3=\{0,2\}$. Then the states are $Q=\{q_0,q_1,q_2\}$ and the final state is $q_2$ (because it contains final state $2$ of the NFA).

0
On

There are two techniques :

1.) You can either use the NFA to DFA conversion algo which google can fetch for you.

2.) If You carefully analyze the language of the given NFA It is "all strings beginning with a and not containing two or more consecutive b's" and "empty string"

Now for that you can simply draw a DFA

enter image description here