CS 356 – Assignment # 2 – Martin van Bommel

advertisement

CS 356 – Assignment # 2 – Martin van Bommel

1.

Question 3 on page 49 of the text.

Prove, by induction on the length of the string, that ( w

R

)

R

= w for all strings w

  *

.

2.

Question 9 on page 49 of the text.

A palindrome over an alphabet

is a string in

 *

that is spelled the same forward and backward. The set of palindromes over

can be defined recursively as follows: i) Basis:

and a , for all a

 

, are palindromes. ii) Recursive step: If w is a palindrome and a

 

, then awa is a palindrome. iii) Closure: w is a palindrome only if it can be obtained from the basis elements by a finite number of applications of the recursive step.

The set of palindromes can also be defined by

 w

 w = w

R 

. Prove that these two definitions generate the same set.

3.

Give a regular expression for the set of strings over { a,b } in which the number of a

’s is divisible by three.

4.

Draw a complete DFA that accepts the set of strings over { a,b,c } in which all the a

’s precede the b ’s, which in turn precede the c ’s. It is possible that there are not a ’s, b ’s, or c

’s.

5.

Draw a complete DFA that accepts the set of strings over { a,b } that do not begin with the substring aaa .

Due: 1 February 1999 (50% off for each day late).

Download