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 that have an odd number of as and an even number of bs. (Remember that 0 is an even number.)
  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.)

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