cs3100 Test 1 October 12, 2004
cs3100 Test 1 October 12, 2004
01.
2. (5 marks)
Give a construction showing that the regular languages are closed under
reversal. In other words, show that if L is regular then the set L
R
obtained
by reversing each string in L is also regular.
2
3. (5 marks)
Show that if L is regular, then the language
{x | x L len(x) is odd}
is regular.
4. (5 marks)
Give a regular expression for the set of all strings whose third symbol from
the left is a 1 and whose third symbol from the right is a 1.
5. (5 marks)
Suppose you have gone to work for Nefarious Spammers Inc. and your
task is to write regular expression patterns that extract email addresses
from webpages. Give a regular expression that will recognize a wide-
variety of email addresses, including those that arent valid, but become
valid when spaces are deleted, the string at is replaced by @, and the
string dot is replaced by a period (.). Thus [email protected] and
Konrad dot Slind at cs dot utah dot edu should both be detected
by your pattern.
3
6. (5 marks)
Minimize the following DFA. Show your work!
q
0
q
1
q
2
q
3
q
4
q
5
0
0
0
0
0
0
4
7. (5 marks)
Give a DFA recognizing the language (0 + 1(01
0)
1)
. Try to remove as
many superuous -transitions as possible.
5
8. (5 marks)
Give a DFA for recognizing the language of all binary strings having a
substring 00 but not ending with 01.
6
9. (5 marks)
Give a regular expression recognizing the set of all binary strings with an
even number of 1s or an odd number of 0s.
10. (5 marks)
Prove the identity 0
(0 + 1)
= (0 + 10