Design DFA to check even number of 1s using 2 states.

588 Views Asked by At

The alphabet is {0,1}. Zero 1s in the string should be rejected. This can be done easily using 3 states. Can this be done usinng 2 states?

1

There are 1 best solutions below

2
On

How about $s_0\rightarrow_0 s_0$, $s_0\rightarrow_1 s_1$, and $s_1\rightarrow_{0,1} s_1$ with start state $s_0$ and end state $s_1$.

Ahh, okay. Sorry for misunderstanding. An even number of 1's. Then the automaton looks as follows:

$s_0\rightarrow_0 s_0$, $s_0\rightarrow_1 s_1$, $s_1\rightarrow_0 s_1$, and $s_1\rightarrow_{1} s_0$, where $s_0$ is the starting and ending state.