Professional Documents
Culture Documents
Assignment # 01
Student Name: Dania Kaka
VU ID: MC210204217
Total Marks: 20
Due Date: May 21, 2021
Construct an FA which accepts the language of strings defined over ∑= {a, b} ending with an
Even number of a’s. Also, draw the transition table.
Ans.
Here,
FA which accepts the language of strings defined over ∑= {a, b} ending with an Even number of
a’s is given below:
a a
qo q1 q2
b a
a
b
q3
b
In the FA drawn above, initial state (q0) is shown by an incoming arrow and final
state (q2) with double circle but they can be depicted by using a – and + sign for
initial and final state respectively. Also, states can be represented with xn and even
with numbers only (1,2,3,..n).
Transition Table:
New States
Old States Reading a Reading b
qo q1 q3
q1 q2 qo
q2 q1 q3
q3 q1 q3
Questions No 02 Marks (10)
1. Mention only the string(s) which is/are not the part of language L accepted by regular
expression 0(1+0)*1 defined ∑={0,1}:
a) 0000
b) 1000
c) 0001
d) 0111
e) 1111
Ans.
According to given regular expression 0(1+0)*1, strings of the language L should start with 0
and end with 1.
Evaluating by the criteria defined above, following strings are not the part of language L
accepted by regular expression 0(1+0)*1 defined over ∑={0,1}:
a) 0000
b) 1000
e) 1111
As strings mentioned in a, b and e do not meet the condition of starting with 0 and ending with 1
set by the given regular expression 0(1+0)*1.
2. Consider the string S= uvrpqst defined over the set of alphabets ∑= {pq, r, st, uv}. You
are required to find out the “reverse” and “length” of the given string “S”.
Ans.
To get reverse of a string, I need to write the letters of string s in reverse order. It is denoted by
Rev(s) or sr.
Here,
S = uvrpqst
Tokenizing = (uv), (r), (pq), (st)
Rev(s) = stpqruv
To find length of a string, I need to count the number of letters in the string s. Length of a string
is denoted by |s|.
S = uvrpqst
Tokenizing = (uv), (r), (pq), (st)
|s| = 4