0% found this document useful (0 votes)
10 views

Unit 2

Uploaded by

sujiblessy0604
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Unit 2

Uploaded by

sujiblessy0604
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

CS3452 – THEORY OF COMPUTATION

UNIT II REGULAR EXPRESSIONS AND LANGUAGES

PART A (2 MARKS) (QUESTIONS WITH ANSWER)

1. State pumping lemma for regular language.


Let L be regular language then there exist a constant n (Number of states that accept
the language L) such that if W is the word or set of input string in the language L then,
1. Z = UVW
2. |UV| ≤ n
3. |V| >= 1
4. UViW Є L For all i ≥ 0

2. Name any four CFG.

Union of two regular language is regular.


 Concatenation of regular language is regular.
 Closure of regular language is regular.
 Complement of regular language is regular.
 Intersection of regular language is regular.

3. Prove or disprove that (r+s)*=r*+s*.

Replace r by {a} and s by {b}. The left side becomes all strings of a's and b's (mixed),
while the right side consists only of strings of a's (alone) and strings of b's (alone). A string
like ab is in the language of the left side but not the right.

4. List out the methods that are used for converting DFA to RE.
The three methods are:
1. Regular Expression Equation Method
2. Arden’s Theorem
3. State Elimination Technique

5. What is pumping lemma?


Let L be a regular language. Then there exists a constant n such that for every string w in L
such that |w| ≥ n, w = xyz such that:
1. y ≠ ε
2. |xy| ≤ n
3. For all i ≥ 0,xyz Σ L
PART B (13 MARKS) (QUESTIONS WITH ANSWER)

1. (i)Construct finite automata to accept the regular expression (0+1)*(00+11)(0+1)*.


(ii)Construct a NFA equivalent to (0+1)* (00+11).

KEY ANSWER

(i) Step 1 − NFA with epsilon for 0+ is given below –

Step 2 − NFA with epsilon for 0* is given below –

Step 3 − NFA with epsilon for (0+1) is given below –

Step 4 − NFA with epsilon for 01 is given below –

The final NFA with epsilon move is as follows –

(ii) First part − (0+1)*

Second part − (00+11)


2. (i)prove that (1+00*1)+(1+00*1)(0+10*1)*(0+10*1) = 0*1(0+10*1)* ?
(ii) Show that L = { 0n 1n+1 | n>0} is not regular ?

KEY ANSWER

(i) https://www.youtube.com/watch?v=TkqcPh0BFUw

(ii) To prove that the language L = {0^n 1^(n+1) | n > 0} is not regular, we can use the

language, there exists a pumping length p such that any string s ∈ L with |s| ≥ p can be
Pumping Lemma for regular languages. The Pumping Lemma states that if L is a regular

divided into three parts, s = xyz, satisfying the following conditions:

1. |xy| ≤ p

2. |y| > 0

3. For all i ≥ 0, xy^iz ∈ L

3. Construct the regular expression corresponding to the state diagram given in the following.

KEY ANSWER

Regular expression
q1=q10+q21
q2=q21+q30
q3=q10+q21
Now,
q1=q10+1(q21+q30)
q1=q10+1(q21+0(q10+q21))
q1=q10+q211+q1001+q2011
q1=(q211+q201)+q1(0+001)
R=Q+RP
By Arden theorem,
q1=(0+001)*
q2=(0+001)*0=r1
q3=(0+001)*1=r2
r=r1+r2

4. Conversion of finite automata to Regular Expression using arden's method

KEY ANSWER

q1 = ε.(0)*
q1 = 0* (ε.R*= R*)
Substituting the value into q2, we will get

q2 = 0* 1 + q2 1
q2 = 0* 1 (1)* (R = Q + RP → Q P*)

The regular expression is given by

r = q1 + q2
= 0* + 0* 1.1*
r = 0* + 0* 1+ (1.1* = 1+)

You might also like