Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Design a DFA that every 00 is immediately followed by 1

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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 *.

StateInput (0)Iinput (1)
—>A* (initial and final state both)BA
B* (final state)CA
CD (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.

My Personal Notes arrow_drop_up
Last Updated : 28 May, 2020
Like Article
Save Article
Similar Reads