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 :

Step-1:
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.



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

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

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

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



Step-6:
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.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

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 contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. 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.