Theory of Automata - CS402 Spring 2004 Assignment 01 Solution
Theory of Automata - CS402 Spring 2004 Assignment 01 Solution
Solution:
Here S is not an alphabet but also it is a set of substrings. That’s why we should take
length of bb as 2 instead of 1.
Strings of length 4 = 22 = 4
Strings of length 5 = 0
Strings of length 6 = 23 = 8
Strings of length 7 = 0
In general, number of EVEN length strings will be 2 N/2 and number of ODD length strings will be
always 0. (N denotes length of string).
Q. 2. Give the recursive definition of language “number multiple of three” L={3, 6, 9, 12, ……}
Solution:
Step 1
3 is in L
Step 2
If x is in L, then is x + 3
Step 3
b
+
a)
a,b
a
a +
- a,b
a,b
a
b +
a,b
b
Solution:
(a + b) a (a + b)* + ab
b)
b b b
a a
Solution:
(b*ab*ab*ab*)*
Q. 4. For ∑={a, b}, build and FA for language Odd-Odd “all words with Odd a’s and Odd b’s ”
Solution:
b
1- 3
b
a a a a
b
2 4+
b
“Words starting and ending in double letters”. RE is (aa + bb)+ (aa + bb)(a+ b)*(aa+bb)
Solution:
+
aa, bb
-
a, b
aa, bb aa, bb
+
(ii) Words not having number of 2 b’s at consecutive places (there should be no string bb in the
any word). RE is a*(baa*)*(b+ Λ)
Solution:
a a
b
+ Λ +
-
a
Λ,b
NOTE: we can generalize many TG’s for a single language so above given solution is not the only
TG for said language but also it is only one of possible solutions.