Design a DFA that every 00 is immediately followed by 1

DFA machines are designed to accept the specific kind of input whose output is generated by the transition of input alphabet from each state.

Approach :

  • In this situation, strings all strings are acceptable except more than 3 zeros. In this kind of string no three continuous zeros are acceptable.
  • Create initial state and start with minimum length of possible string do transition of its input 0 and 1 to possible states.
  • according to transition ,notice the final state and mark it.

Designing DFA step by step :

Make a initial state,say “A”, minimum possible strings are 1 and 0 and also any number of 1 are acceptable.To do this put self loop of 1 on state “A” and make transition of input alphabet 0 to state “B”.Because only 1’s are acceptable so state “A” is termed as final state as well.

As single zero is acceptable in the string so make state “B” is final state.Transect input 0 from state “B” to state “C”.

As every 00 is immediately followed by 1 so now after state “C” do transition of input 1 from state “C” to state “A”.

We are left with transition of input alphabet 1 of state “B”.So make transition of 1 from state “B” to state “A”.

After 00 not more zero is acceptable in continuity.So transect 0 of state “C” to dead state “D”.

Input alphabet 0 and 1 of dead state transect to dead state itself.

Transition Table and Transition rules of above DFA –
State “A” is both final as well as the initial state, state “C” is final state, state “D” is Dead State. Initial state is depicted by —> and final state ids depicted by *.

State Input (0) Iinput (1)
—>A* (initial and final state both) B A
B* (final state) C A
C D (dead state) A
D (dead state) D (dead state) D (dead state)

Q’: set of finite sets = {A, B, C, D}
set of input alphabets = {0, 1}

Transition Rules tells about the transition function working on each state with each input alphabet.

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.