# COMS W3261 Computer Science Theory Homework Assignment #1 September 12, 2012 Due in class 1:10pm, September 24, 2011

## Instructions

• You may consult with others but your answers must be written in your own words.
• Problems (1)-(5) are each worth 20 points.
• This assignment may be handed in September 26, 2011 for 50% credit.

## Problems

1. Find the lexicographically first longest English word that can be made up from the letters of your first and last name. (Letters can be used more than once.) Show the regular expression and commands you used to find the answer.

2. In Lecture 3 (9/12/2012) we presented a three-state DFA that recognizes all binary strings divisible by 3. Prove that state A represents all prefixes of binary strings that are congruent to 0 mod 3, state B all prefixes congruent to 1 mod 3, and state C all prefixes congruent to 2 mod 3.

3. Let L be the language generated by the regular expression (a+b)*a(a+b)(a+b).
1. Construct a nondeterministic finite automaton (NFA) for L. (Identify the five components of your NFA. Use a transition diagram for the transition function.)
2. Show how your NFA processes the input string `abaab`.
3. Using the subset construction convert your NFA into an equivalent DFA.
4. Show how your DFA processes the input string `abaab`.

4. Construct an epsilon-NFA from the regular expression in problem (3) using the McNaughton-Yamada-Thompson algorithm. Show how your epsilon-NFA processes the input string `abaab`.

5. Let L be the language { `w` | `w` is any string of `a`'s and `b`'s with the same number of `a`'s as `b`'s }. If L is regular, construct a DFA for L; if not, use the pumping lemma to show L is not regular.

aho@cs.columbia.edu