2

I can't seem to make it work. I think I managed to produce a solution when it's exactly one occurrence of 010 but not when it's at most one occurrence. Check out my automaton.

1 Answers1

1

I suggest the following states:

  • $A$: initial
  • $B$: have not seen $010$ yet, just saw $0$
  • $C$: have not seen $010$ yet, just saw $01$
  • $D$: have seen $010$ already
  • $E$: have seen $010$ already, just saw $0$
  • $F$: have seen $010$ already, just saw $01$

with transitions $A\stackrel 0\to B$, $A\stackrel 1\to A$, $B\stackrel 0\to B$, $B\stackrel 1\to C$, $C\stackrel 0\to E$, $C\stackrel 1\to A$, $D\stackrel 0\to E$, $D\stackrel 1\to D$, $E\stackrel 0\to E$, $E\stackrel 1\to F$, $F\stackrel 0\to $☠, $F\stackrel 1\to D$ and all states (except ☠) accepting.

(According to the comment added that $01010$ should only count one occurance of $010$, we need the transition $C\stackrel 0\to D$ instead of $C\stackrel 0\to E$)

  • 1
    I'm always a bit conflicted in cases like this. From an educational perspective I believe your answer would actually be better without giving the transitions and letting the asker figure it out for themselves. From a knowledge base perspective your answer right now is better... – orlp Feb 22 '19 at 21:25