3

I am stuck with constructing an DFA that has at most in it.

The question I am stuck with is:

Design an DFA that accepts all strings over {0, 1} that contain at most two 00’s and at most three 11’s as a substring.

An answer in a form of a graph would be perfect but if someone can explain in plain words, I will appreciate that as well.

Gana
  • 39
  • 1

2 Answers2

2

You can use states of the form $(i,j)$ where $i$ counts the number of 00s and $j$ counts the numbers of 11s read so far.

Corristo
  • 151
  • 6
1

This is a sadistic question...

It is easy to build a DFA over a, b for "at most 2 a" or "at most 3 b"; and build a DFA for the intersection (states are pairs of states, one of each automaton; transitions trace the first automaton in the first part of the state and of the second similarly; final states are composed of final states for both).

The same ideas (more complicated, but similar) give "at most two 00" or "at most three 11", and then build the intersection.

vonbrand
  • 14,204
  • 3
  • 42
  • 52