Theory of Algorithms 2019 Practice session 2.
Finite Automata
1. Let Σ = {0,1}. Give a deterministic finite automaton that accepts the words that contain an even number of zeros and an odd number of ones.
2. Let Σ = {0,1}. Give a deterministic finite automaton that accepts the words that contain an even number of zeros, while the number of ones is divisible by three.
3. Let Σ ={0,1}. Give a deterministic finite automaton that accepts the words that contain at least three1’s.
4. Let Σ ={0,1}. Give a deterministic finite automaton that accepts the words that do not contain subword 001.
5. Which words are accepted by this automaton? (Σ ={0,1})
A B C
0 1
1 0 0,1 6. Perform the following for both nondeter-
ministic finite automata
(a) Give the computation tree of word baabab.
(b) Create an equivalent DFA by the procedure studied in class.
(c) Which languages are recognized by these automata?
S A
B
C
D a,b
a b
a
b
a,b
a,b
A B
C a
a,b a,c
a,c b
b
a,b c
c
7. Give a nondeterministic finite automaton that accepts those words that have 10100 as subword.
8. Prove that the language that consists of those words that have two 1’s such that the number of 0’s between them is divisible by four, is regular. (There could be several 1’s between the two chosen1’s, besides the 4k 0’s.)
9. Design a finite automaton that accepts positive rational numbers written in decimal form. (Σ contains the decimal point and digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The number to be accepted is either an integer without decimal point (e.g. 123), or it contains a decimal point. In this latter case numbers without integer part or fractional part must also be accepted, but at most one of these parts may be missing. (For example, 123.456, 123. and .456 are all accepted but a single decimal point is not.) It is also requested that a number cannot begin with dummy 0’s, however 0.456is OK.
10. Let Σ = {0,1}. The sequences are considered as binary numbers. Give a finite automaton that accepts exactly those words that represent numbers divisible by three in binary form. Take into consideration that a number does not begin with 0, except for number zero itself, and that the input number is read beginning with the most significant digit.
11. Let language Lk consist of those words over alphabet Σ ={a,b} that have character bon the kth position counting from backwards. (For example bbaa∈L3∩L4.)
(a) Prove that there exists a nondeterministic automaton of k+ 1 states recognizing language Lk for all k≥1.
(b) Prove that every deterministic automaton recognizing Lk has at least 2k states.
12. Prove that every NFA can be transformed so that the recognizes the same language, however it has a unique accept state.
13. The language LR is obtained from language Lso that every word in Lis reversed, that is the characters of the word are written in reverse order. Prove that L is regular ⇐⇒ LRis regular.