GATE Computer ScienceVery hardGATE CS (PYQ pattern)

Moore machine: the output is 1 exactly when the last four serial input bits (one per clock) are 0110 or 1001, and 0 otherwise (also before four bits have arrived). Overlapping occurrences are allowed. What is the minimum number of states of such a machine?

  1. A. 8
  2. B. 9
  3. C. 5
  4. D. 16

Correct answer: B. 9

The minimal machine is the Aho-Corasick style automaton with one state per prefix of 0110 or 1001 (ε, 0, 01, 011, 0110, 1, 10, 100, 1001), and no two of them are equivalent: 9 states. A single-pattern detector needs only 5.

More Digital Logic questions

Exams that ask this topic