0% found this document useful (0 votes)
16 views

Tutorial 5

1. The document provides examples of finite automata (FA), regular expressions (RE), and languages. 2. It asks the reader to match languages with their corresponding REs and FAs. 3. The languages, REs, and FAs are provided in tables to facilitate the matching.

Uploaded by

Dipaa Lakshmi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Tutorial 5

1. The document provides examples of finite automata (FA), regular expressions (RE), and languages. 2. It asks the reader to match languages with their corresponding REs and FAs. 3. The languages, REs, and FAs are provided in tables to facilitate the matching.

Uploaded by

Dipaa Lakshmi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

5 Push-down

Automata

SCSJ 3203: Theory of Computer Science


Tutorial 4: FA Part 2

1. Consider the following NFA. Determine whether the following strings are IN or NOT IN the language by
putting/writing them in the right column in Table 2.

a q2 b
 a
q1 q3
c c
q4 

a, b, c, ab, ac, bc, aab, acc, acab, ca, cb, abab, abaab, cc, cab, caab, caa, ccab, ccac, abacab
Table 2.

IN the language NOT IN the language


c, ab, ac, acc, acab, abab, abaab, cc, cab, caab, a, b, bc, ca, cb, aab, caa,
ccab, ccac, abacab

2. Let M be the FA with state diagram


b a, b

a a a
q0 q1 q2 q3
b
b

a) Construct the transition table of M. Is this a deterministic FA or not?


b) Trace the computations of M that process the strings aaa, aab and baaab.
c) Which of the strings from (b) are accepted by M?
d) Give a regular expression for L(M).

3. Let M be a finite automaton defined by


Q = {q0, q1, q2} 
a b
 = {a, b} q0 q1 -
q0 = q0; F = {q2} q1 q2 q1
q2 - -

a) Give a state diagram (FA) for this state table. Is this a deterministic FA or not?
b) Trace the computations that process the strings aa, bb and abba.
d) Give a regular expression for the language accepted by M.

4. Write a regular expression and a finite automata for L1 = {wuw: |w| = 2; w, u ∈ Σ*}. Σ = {a, b}.

90 | P a g e
5 Push-down
Automata

5. Consider the languages in Table 2. Match them with the Regular Expressions (RE) from Table 3 and Finite Automata (FA) from Table 4. The
alphabet is  = {a, b}.

Table 2. Table 3. Table 4.


Matched Match
No. The language of … no. Regular Expressions (RE) ed no. Finite Automata(FA)

a
1. All strings. 5. (a + b) 4. q0 q1
b

2. All strings except empty string. 6 (a + b)*ba(a + b)* 12

a, b a, b a, b
All strings that start with zero or more a‘s
3. 7 ba(a + b)* 13 a a
and followed by zero or more b‘s. q0 q1 q2

a, b
All strings that contain only zero or more
4. 1. (a + b)* 10 q0 q1
substring ab.
a, b

All strings that contain of one a or one b


5. 2. (a + b)+ 15
only.

a
6. All strings that contain the substring ba. 3. a*b* 5. q0 q1

b
a, b a, b
7. All strings starting with ba. 4. (ab)* 6 b a
q0 q1 q2

91 | P a g e
5 Push-down
Automata

a, b
8. All strings ending with ba. 12 (a + b)*a(a + b)*a(a + b)* 7 b a
q0 q1 q2

a, b
9. All strings that begin AND end with ba. 13 ((a + b)(a + b)) 1.
q0

a, b
10. All strings of even length 14 (a + b)*b(a + b) 2. a, b
q0 q1

a b
11. All strings containing exactly two a’s. 15 (a + b)b(a + b)* 3. b
q0 q1

b b b
12. All strings containing at least two a’s. 8 (a + b)*ba 11 a a
q0 q1 q2

a, b
13. All strings of length two. 9 ba(a + b)*ba 8 b a
q0 q1 q2

a, b
The language of all strings with b as the
14. 10 ((a + b)(a + b))* 9 b a b a
second last letter. q0 q1 q2 q3 q4

a, b
The language of all strings with b as the
15. 11 b*ab*ab* 14 b a, b
second letter. q0 q1 q2

92 | P a g e
5 Push-down
Automata

6. Consider the Regular Expressions in Table 8. Match them with the Finite Automata (FA) from
Table 9. The alphabet is  = {a, b}.
Table 8. Table 9.
Matched
No. Regular Expressions (RE) No.
Finite Automata (FA)
a a, b

1. (a + b)*a 4 q0
b
q1
b
q2
a

b b b a, b
2. a*b+ 3 a a a
q0 q1 q2 q3

a, b

3. b*ab*ab* 1 a
q0 q1

q1

b b

4. (a + b)*bb(a + b)* 5 q0
b a

q2

5. (bb + ba)* 2 q0
b
q1
b

a, b a, b

b
q0 q1
6. (ab)*ba 9
a
a
q2

b
a
7. (ab)*(ba)* 10 q0 q1
b
b

a
q0 q6
8. (b + bba)*a 8 b a
b
q3 q4

a
q0 b q1

9. (a + b)*(b + aa)(a + b)* 7 b


a
q2 q3
b

a
q0 b q1
10. (b + ab)* 6 b
a
q2 q3

93 | P a g e

You might also like