Hồ Chí Minh City University of Technology
Faculty of Computer Science and Engineering
Exercise for chapter 4 (Part 2)
Determinisation
1
Introduction
In this exercise, we will pratice mainly on automata determinisation - from NFA (nondeterministic
finite automata) to DFA (deterministic finite automata). Students should review the slide and related
documents for chapter 4 before doing the exercises below.
2
Example
Question 1.
Give an execution of the following DFA on 0001, 01001, and 0110.
0
0
1
1
A
B
C
1
0
Solution.
• (A, 0001) → (A, 001) → (A, 01) → (A, 1) → (B, −) ⇒ 0001 is a valid word.
• (A, 01001) → (A, 1001) → (B, 001) → (C, 01) → (C, 1) → (B, −). Then, 01001 is a valid word.
• (A, 0110) → (A, 110) → (B, 10) → (A, 0) → (A, −). Since A is not an accepting state, then 0110
is an invalid word.
✷
Question 2.
Convert the following NFA into DFA.
Give an execution of the DFA on aaba, bbabbbaa, bababaa and bbabbbabbbabba.
a, b
a, b
A
a
B
b
C
Solution.
First, we need define transition table containing useful sets of states as follows.
→ {A}
{A, B}
{C}∗
a
{A, B}
−
{C}
b
{A}
{C}
{C}
DFA could be determined in which each state refers a useful sets of NFA state.
Discrete Mathematics II
Page 1/3
Hồ Chí Minh City University of Technology
Faculty of Computer Science and Engineering
a, b
b
{A}
a
{A, B}
b
{C}
✷
3
Exercise
Question 3.
Convert the following NFA into DFA.
b
b
a, b
A
a
B
b
a
C
b
D
Question 4.
Convert the following NFA into DFA.
a, b
C
a
b
a
A
b, ε
B
b
b
b
D
b
Question 5.
Find a regular expression for the set {an bm : (n + m) is even }.
Determine the corresponding DFA (or NFA and then convert NFA to DFA).
Question 6.
Give a regular expression for the language on Σ = {a, b, c} containing no run of a’s of length greater
than two.
Determine the corresponding DFA (or NFA and then convert NFA to DFA).
Discrete Mathematics II
Page 2/3
Hồ Chí Minh City University of Technology
Faculty of Computer Science and Engineering
Question 7.
Give a regular expression for the language on Σ = {a, b} containing all strings not ending in ab.
Determine the corresponding DFA (or NFA and then convert NFA to DFA).
Question 8.
Give a DFA that accepts L = ((a + b)∗ b(a + ab)∗ ).
Question 9.
Let Σ = {a, b, c}. Give complet DFA’s for the sets consisting of
a) all strings with exactly one ’a’.
b) all strings of even length.
c) all strings which the number of appearances of ’b’ is divisible by 3.
d) all strings ending with ’a’.
e) all strings not ending with ’a’.
f) all non-empty strings not ending with ’a’.
g) all strings with at least one ’a’.
h) all strings with at most one ’a’.
i) all strings without any ’a’.
j) all strings including at least one a and whose the first appearance of ’a’ is not followed by a ’c’.
Discrete Mathematics II
Page 3/3