Sie sind auf Seite 1von 3

H Ch Minh City University of Technology

Faculty of Computer Science and Engineering

Exercise for chapter 4 (Part 1)


Automata

Introduction

In this exercise, we will be familiar with some basic concepts and definitions in automata: language,
regular expression, finite automata and NFA (nondeterministic finite automata). Students should
review the slide and related documents for chapter 4 before doing the exercises below.

Exercises with solution

Exercise 1.
Let = {a, b} and L = {ab, aa, baa}.
Which of the following strings are in L : abaabaaabaa, aaaabaaaa, baaaaabaaaab, baaaaabaa?

Solution.
2

abaabaaabaa, aaaabaaaa, baaaaabaa

Exercise 2.
Which of the strings 0001, 01001, 0000110 are accepted by the following NFA:
0
0
1
1
q0
q1
q2
0
0

Solution.
2

0001, 01001

Exercise 3.
Consider the set of strings on {0, 1} in which every 00 is followed immediately by 1. For example 101,
0010, 0010011001 are in the language, but 0001 and 00100 are not. Construct an accepting automata.

Solution.
1
1
A

Homework

Exercise 4.
Let = {a, b}.
Find all strings in L = ((a + b) b(a + ab) ) of length less than four.

Exercise 5.
Let = {a, b}.
Discrete Mathematics II

Page 1/3

H Ch Minh City University of Technology


Faculty of Computer Science and Engineering

For which language it is true that L = L ?


a) L = an bn+1 : n 0
b) L = w : na (w) = nb (w)

Exercise 6.
Give a finite automata for the language L = {a, ba, aba, bab, bbba}.

Exercise 7.
Let = {a}. Give finite automata for the sets consisting of
a) all strings with exactly one a.
b) all strings with no more than three as.

Exercise 8.
Let = {a, b}.
Give finite automata for the sets consisting of
a) all strings with exactly one a.
b) all strings with no more than three as.

Exercise 9.
Give an automata for the language L = {ab5 wb4 : w {a, b} }.

Exercise 10.
Find NFAs for the following languages on = {a, b}
a) L = {w : |w| mod 3 = 0}
b) L = {w : |w| mod 5 6= 0}
c) L = {w : na (w) mod 3 > 1}

Exercise 11.
Show that the language L = an : n 0, n 6= 4 is regular.

Exercise 12.
Find (q0 , a) and (q1 , ) for the following NFA
a

q0

q1

q2

Exercise 13.
For the following NFA, find (q0 , 1010) and (q1 , 00).
1
0, 1
q0
q1
q2
0

Discrete Mathematics II

Page 2/3

H Ch Minh City University of Technology


Faculty of Computer Science and Engineering

Exercise 14.
Find an NFA with three states that accepts the language {ab, abc}

Exercise 15.
Let = {a, b, c}.
Give complet NFAs 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.
Complet automata: a finite automata in which from each state, it is defined precisely when receiving
any event.

Discrete Mathematics II

Page 3/3

Das könnte Ihnen auch gefallen