GATE Computer ScienceVery hardGATE CSE

Let L be the set of strings over {a, b} in which the third symbol from the right is a, or the last symbol is b (strings shorter than 3 satisfy only the second condition). How many states does the minimal complete DFA for L have?

  1. A. 9
  2. B. 6
  3. C. 8
  4. D. 7

Correct answer: D. 7

The DFA must remember the last 3 symbols plus whether the string is shorter than 3; collapsing equivalent histories by Moore partition refinement leaves 7 states.

More Theory of Computation questions

Exams that ask this topic