View
220
Download
5
Category
Preview:
Citation preview
AssignmentCS402
Question No 1: Let r1= (a+b)*ab(a+b)*
r2= (a+b)*bb(a+b)*
FA1 corresponding to r1
FA2 corresponding to r2
Using the FAs corresponding to r1 and r2, Build an FA corresponding to
a) r1+ r2 (Union of r1 and r2). b) r1r2 (Concatenation of r1 and r2).c) r1* (Closure of r1).
a) r1+ r2 (Union of r1 and r2).
Old NewA B
L1- = (x1.y1) L2 = (x3,y2) L3 = (x2,y1) L2+ = (x3.y2) L2 = (x3,y2) L4 = (x3,y1) L3+ = (x2.y1) L5 = (x2,y2) L3 = (x2,y1) L4+ = (x3.y1) L2 = (x3,y2) L4 = (x3,y1)
L5+ = (x2.y2) L5 = (x2,y2) L3 = (x2,y1)
b) r1r2 (Concatenation of r1 and r2).
Old NewA B
L2- = y1 L2 = x3 L3 = (x2,y1) L2 = x3 L3 = (x2,y1) L3 = (x2,y1) L3 = (x2.y1) L4 = (x2, y1, y2) L3 = (x2,y1) L3+ = (y2.y1) L4 = (x3,y1,y2) L3 = (x2,y1)
c) r1* (Closure of r1).
Old NewA B
L1+
L2
L3
a
b
a
b
a
bb
a
L1-
L4
L3
L2a
b
b
a
b
a
a,b
Final L1+- = y1 L3 = (x2,y1) L2 = y1 Non final L2 = y1 L3 = (x2,y1) L2 = y1 L3+ = (x2.y1) L3 = (x2,y1) L2 = y1
Question No 2: Marks: 4
Convert the following NFA into FA.
L0
-
L1
+
L2
a
a
a
b
b
a,b
b
Question No 3:
Build an NFA equivalent to the FA* where
FA
Answer
L1-
L4
L3
L2
+
L5
+
a
a
a
a
a
b
b
b
b
b
Recommended