# CMPSCI 311: Theory of Algorithms

### Due Friday 21 November 2003 in class

#### (or earlier to hand-in box in CMPSCI main office)

Twelve of the 13 questions are from [L] -- "B7.1" is written by me and the entire problem statement appears here. Point values are as indicated. There are 100 total points plus ten extra credit.

• Question 8.1.2, page 279 (5):

• Question 8.1.3, page 279 (5):

• Question 8.1.4, page 279 (10):

• Question 8.1.9, page 280 (10):

• Question 8.2.4, page 288 (5):

• Question 8.2.5 page 288 (10):

• Question 8.2.7 page 288 (10):

• Question B7.1 (10, extra credit): In CMPSCI 250, the transformation from a DFA to a regular expression is usually done by the "state elimination method". There is another method that is similar to the Floyd-Warshall algorithm in section 8.2 of [L]. If x and y are states of the DFA, and all the states of the DFA are numbered 0 through n-1, define the language Z(x,y,i) to be the set of all strings that can be accepted by the DFA where all intermediate states in the path are numbered less than i. Then Z(x,y,0) is easily determined from the transition table of the DFA, and Z(x,y,n) is the set of all strings that take state x to state y. The rule for computing Z(x,y,i+1) is as follows: Z(x,y,i+1) is Z(x,y,i) unioned with Z(x,i,i)[Z(i,i,i)]*Z(i,y,i).

Use this method to find a regular expression for the language of the following DFA. The states are {0,1,2}, the start state is 0, the only final state is 2. For each i, δ(i,a) = (i+1)%3 and δ(i,b) = i. Your calculation will be easier (and easier to grade) if you take advantage of regular expression identities -- for example (e+b)* = b* where e is the empty string.

• Question 8.3.5, page 294 (5):

• Question 8.3.7, page 294 (10):

• Question 8.3.10, page 294-5 (10):

• Question 8.4.1, page 299 (10):

• Question 8.4.9, page 300 (10):