CMPS346-Tutorial 3 - Solution
CMPS346-Tutorial 3 - Solution
Tutorial #3
a. L1={ w | w {a, b}*, w has at least three a’s or at least two b’s}
b. L2={ w | w {0, 1}*, w ends with 01 or has even number of 1’s}
Answer
a.
b. L2={ w | w {0, 1}*, w ends with 01 and has even number of 1’s}
L2=L2’ ∩ L2’’ where:
L2’={ w | w {0, 1}*, w ends with 01}
L2’’={ w | w {0, 1}*, w has even number of 1’s}
Q1={q0,q1,q2}
∑={0,1}
Ծ1 0 1
q0 q1 q0
q1 q1 q2
q2 q1 q0
Q2={s0,s1}
∑={0,1}
Ծ2 0 1
s0 s0 s1
s1 s1 s0
Q={(q0,s0) , (q0,s1) , (q1,s0) , (q1,s1) , (q2,s0), (q2,s1) }
∑={0,1}
Ծ 0 1
(q0,s0) (q1,s0) (q0,s1)
(q0,s1) (q1,s1) (q0,s0)
(q1,s0) (q1,s0) (q2,s1)
(q1,s1) (q1,s1) (q2,s0)
(q2,s0) (q1,s0) (q0,s0)
(q2,s1) (q1,s1) (q0,s0)
a. L1= {w| w ends with one of 0110, 010, and 00 } with three states Σ
={0,1}
c. L3= {w| w contains odd number of 0’s or the number of 1’s is not
multiple of 3} Σ ={0,1}
g. L7= {w| the first and last characters in w are the same} Σ ={0,1}
h. L8= {w| w end in 010 and have 011 somewhere preceding, or end in
101 and have 100 somewhere preceding}
3. Let
Σ=¿ ¿
Consider each row to be a binary number and let
L= {w * | the top row is a larger binary number than the bottom row}
[0¿]¿¿¿ [0¿]¿¿¿
E.g., ¿ , but ¿ . Show that L is regular.
Answer: