GATE Computer ScienceVery hardGATE CS (PYQ pattern)

L = { w ∈ {a, b}* : n_a(w) ≡ 1 (mod 3) or w contains bb as a substring }. The minimal complete DFA has how many states?

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

Correct answer: A. 7

While no bb has occurred, track (n_a mod 3, last symbol is b): 3 × 2 = 6 states; once bb occurs the string is accepted forever, adding an accepting sink: 7.

More Theory of Computation questions

Exams that ask this topic