Professional Documents
Culture Documents
Theory Lecture 17
of DFA Important
Automata Examples and
Solutions
Lecture 17: DFA Important Examples and Solutions alisoomro666@gmail.com
a,b a, b
b a, b a q1
q0
q2 a, b
b
q2
a,b a,b
b
a, b
a, b
q2
q2
R = (a+b)b(a+b)*
a,b
a,b b
q0 q2
ab q1
bb a
abaa
bbaa q3 a, b
abaababa
q0: Initial State
q2: final State (accepting state)
q3: Dead State (Dead End State / trap / rejecting)
Lecture 17: DFA Important Examples and Solutions alisoomro666@gmail.com
Q: Draw fa for the language that have exactly 4 ones in every string over
∑={0,1}
R = 0* 1 0* 1 0* 1 0* 1 0*
0 0 0 0 0
1 1 1 1
q0 q1 q2 q3 q4
1111
01111
1
011110
010101010
q5 0, 1
q0: Initial State
q4: final State (accepting state)
q5: Dead State (Dead End State / trap / rejecting)
Lecture 17: DFA Important Examples and Solutions alisoomro666@gmail.com
Q: Draw fa for the language that only accept L = {01, 011 , 100} over
∑={0,1}
R = 01 + 011 + 100
0 1
q0 q1 q2
0 0
1 1
0 0
q7 q6 q5 1
1
0, 1
q0: Initial State 0, 1
q4 q3
q2, q3, q7: final State 0, 1
q4: Dead State (Dead End State)
Lecture 17: DFA Important Examples and Solutions alisoomro666@gmail.com
R= b* a b*
b b
a a
q0 q1
ab
ba a
bab
bbbabbb
a, b
q2
R= (0+1)* 00 (0+1)*
1 0,1
00 0 0
100 q0 q1 q2
1001 1
101001
010001
11100111 q0: Initial State
q2: final State (Accepting State)
10001
Lecture 17: DFA Important Examples and Solutions alisoomro666@gmail.com
Q: Draw fa that accept all strings with double aa in somewhere over ∑ = {a, b}
aa b a,b
baa a a
q0 q1 q2
baab
b
babaab
abaaab
bbbaabbb
q0: Initial State
baaab q2: final State (Accepting State)
Lecture 17: DFA Important Examples and Solutions alisoomro666@gmail.com
R = baa
b a a
q0 q1 q2 q3
b b
a a, b
q4 a, b
R = baa + ab
b a b a a
q6 q5 q0 q1 q2 q3
a b b
a, b a, b
q4 a, b
R = ab* b
a
q0 q1
a
b a, b
q2
Q: Draw fa that accept all words starting and ending with a over ∑= {a , b}
R = a(a+b)*a
b a
a
q0 a q1 q2
b
q0: Initial State b a, b
q2: final State q3
q3: Dead End State
Lecture 17: DFA Important Examples and Solutions alisoomro666@gmail.com
R = xy(x+y)* x,y
q0
x
q1
y xyxx
q3
xyyyy
x
xyxxyy
y x, y
q2
yx
q0: Initial State xx
q3: Final State (Accepting State)
q2: Dead State (Dead End State/Trap State/Rejecting State)
Lecture 17: DFA Important Examples and Solutions alisoomro666@gmail.com
R = ( aa + ab + ba + bb )*
a, b
q0 q1
a, b
R = a* + ( a* ba* ba*)*
a a
b
bb q0 q1
aaaa
baba b
bbaa
R = 0*10* (10*10*)*
0 0
1
q0 q1
a b
q0 q1 q2
abab
a
abbab
b
of Thank you
Subscribe
Automata
By: Ali Hassan Soomro
BSCS from UBIT, University of Karachi
DAE in Electronics from SBTE
Facebook: www.facebook.com/AliiHassanSoomro
Gmail: alisoomro666@gmail.com