You are on page 1of 4

Exercise of Theory of Computation, FSM

1. Design Finite state automata for the following:


P
(a) Recognizes all strings over the alphabet = {1, 0} that starts with
00 and ends with 11.
P
(b) Recognizes all binary strings over the alphabet = {1, 0} that is
divisible by 3.
P
(c) Recognizes all binary strings over the alphabet = {1, 0} that is
divisible by 5.
(d) Recognizes the string in base-3 where the sum of the digits are divis-
ible by 3. (Example: 202011 input implies (2 + 0 + 2 + 0 + 1 + 1) is
divisible by 3)
(e) Recognizes the string in base-3 where the sum of the digits are divis-
ible by 2. (Example: 201012 input implies (2 + 0 + 1 + 0 + 1 + 2) is
divisible by 2divides by 2)

2. Draw the transition diagram of the following FSM.

(a) The transition matrix is as follows..


P
Q/ 0 1
q0 q3 q1
q1 q3 q0
q2 q0 q3
q3 q1 q2
q0 is the start state and q3 is the final state.
(b) The transition matrix is as follows..
P
Q/ 0 1 φ
q0 q0 q1
q1 q2 q1 q3
q2 q2 q3 q0
q3 q0 q3
q0 is the start state and the final state.

3. Construct NFA from the following regular expression.

(a) (φ + 0)(11 + 00)∗


(b) (1 + 0)∗ 11(0 + 1)∗
(c) 1∗ 01∗ 01∗
(d) (+ + - + φ)(0 + 1 + 2 + .. + 9)∗ (. + φ)(0 + 1 + 2 + ... + 9)∗

4. Find the equivalent DFA for the NDFSA as in the figure 1,2 and 3.

1
b
q2 q3

a b
q0 q1 q6 q9
q7 q8

a
q4 q5

Figure 1: Unmark transitions are φ.


b
q3 q4

b q7
q0 q1 q2 q8

q5 a
q6

Figure 2: Unmark transitions are φ.


b
p1 p2

p0 p5

a
p3 p4

c b
q0 q1 b q2 q3
r1 r2

r0 r5

c
r3 r4

Figure 3: Unmark transitions are φ.

5. What is φ-CLOSURE of a state. Define the φ-CLOSURE(T) of a set of


state T. Find φ-CLOSURE({q0, q3}) from figure 2.

2
Find φ-CLOSURE({q0, p0, r0}) from figure 3.
6. Find the φ-CLOSURE(T) for the NDFSA as in figure 3, where T is as
follows.
(a) T = {q0, p0}
(b) T = {q2, q1}
7. Write down the algorithm to convert a NDFSA to DFA using φ-CLOSURE(T).
8. Find the regular expression if the FSM of figure 4,5 and 6.

0 0

1 1
q0 q1 q2

Figure 4: FSM
0

1
q0 q1
0

Figure 5: FSM
1
q0 q1
1

0 0 0 0

1
q3 q2
1

Figure 6: FSM

9. Find the regular expression that represents the complement of the Regular
Set described by the following regular expression.
(a) aa(a + b)∗ bb
(b) 1∗ 01∗
(c) (φ + 0)(1 + 10)∗
10. Find the FSM that represents the intersection of two regular sets as in
follows:

3
(a) aa(a + b)∗ and (aa + bb)∗
(b) 1∗ (01)∗ and (10)∗ 1

11. Let R is a regular language represented by the regular experience as bellow:


Find the regular experience of the language RR (i.e. the reverse of R).

(a) aba(a + b)∗


(b) (10 + 11)∗ (00 + 11)

12. Show that if R is regular then RR is also regular.

You might also like