YCP Logo Problem Set 1

Due: Friday, September 5th by 11:59 PM

Note that these problems are available as a RegexEx problem set at the following URL:

http://faculty.ycp.edu/~dhovemey/fall2008/cs340/problems/hw1regex

If you use RegexEx to test your solutions, you still need to submit your solutions in a text file as described in the "Submitting your work" section below.

Problem 1

Define a regular expression that generates the following language over the alphabet {a, b}:

a
aaab
aaabaab
aaabaabaab
...etc...

Problem 2

Define a regular expression that generates the language over the alphabet {a, b} of all strings containing at most two occurrences of a.

For example, the following strings are members of the language:

ε
a
ba
aba
bbaa
aba

The following strings are not members of the language:

aaa
baabaa
baaaa

Problem 3

Define a regular expression that generates the language over the alphabet {a, b} of all strings containing an odd number of b's.

For example, the following strings are members of the language:

b
ab
aba
bbabaa

The following strings are not members of the language:

ε
abb
bababb

Problem 4

Define a regular expression that generates the language over the alphabet {a, b, c} of all strings not containing the substring ba.

For example, the following strings are members of the language:

ε
a
ab
bb
bc
cbc
abbb

The following strings are not members of the language:

ba
baba
aba
ccaabac

Problem 5

Define a regular expression that generates the language over the alphabet {a, b} of all strings in which the first occurrence of the symbol a (if it occurs in the string at all) is followed by at least one additional a.

For example, the following strings are members of the language:

ε
b
bb
aa
baaba
aaabaa

The following strings are not members of the language:

a
bba
babaa

Submitting your work

Save a text file containing your solutions to problems 1-5.

Submit your text file to the Marmoset server as project hw1. The URL of the server is:

https://camel.ycp.edu:8443/