DFA that contains 1101 as a substring

Waqar Danish picture Waqar Danish · Aug 29, 2017 · Viewed 8.8k times · Source

I have to draw a DFA that accepts set of all strings containing 1101 as a substring in it. I tried one by myself but wanted to make sure if it's correct but can't attach the image as I'm a new user.

Thanks

Answer

Mathews Sunny picture Mathews Sunny · Sep 1, 2017

Its an easy DFA. It requires 5 states.

  1. state 0 :
    • On receiving 1 move from state 0 to state 1
    • On receiving 0 stay on state 0
  2. state 1 :
    • On receiving 1 move from state 1 to state 2
    • On receiving 0 move from state 1 to state 0
  3. state 2 :
    • On receiving 0 move from state 2 to state 3
    • On receiving 1 stay on state 2
  4. state 3 :
    • On receiving 1 move from state 3 to state 4
    • On receiving 0 move from state 3 to state 0
  5. state 4 :
    • On receiving 1 stay on state 4
    • On receiving 0 stay on state 4

So it will look like