DFA short exercise

Construct a DFA for each of the following languages. In each case, let the alphabet be {a, b}.

  1. Strings that have exactly one a
  2. Strings that have no more than three as.
  3. Strings that have at least one a and exactly two bs.
  4. Strings of two to four as followed by zero to three bs, for example aabbb, aaabb, and aaaa.
  5. Strings that have both ab and ba as substrings. (Make sure that your DFA will accept a string like aaaabaaa; ab and ba are both substrings, even though they overlap.)

Some of these exercises are taken from Lewis and Papadimitriou, Elements of the Theory of Computation, Prentice Hall, 1998. There's a copy in the CSCI 335 library.


Last modified: Thu Mar 31 16:18:12 CDT 2011