FAFL Final Lecture 1.9 CMH
FAFL Final Lecture 1.9 CMH
Lecture 1.9
Deterministic Finite
Automata
School of CSE
OUTLINE
Recap of Previous Lecture
Lecture Discussion
Course Description
DFA accepting strings that containing given Substring
Solution
δ a b
a, b
q0 q1 *q0 q1 q1
a, b
q1 q0 q0
D FA A C C E P T I N G S T R I N G S B A S E D O N
L E N G TSolving
Problem H OF THE STRING
Construct a DFA to accept the string over { a, b } such that the
length of the string is multiple of 3.
Here
Ʃ={a, b} and L = {λ, aaa, aab, aba, abb, baa, bab, bba, … }
Solution δ a b
a, b a, b *q0 q1 q1
q0 q1 q2
q1 q2 q2
a, b q2 q0 q0
D FA A C C E P T I N G S T R I N G S B A S E D O N
L E N G TSolving
Problem H OF THE STRING
Construct a DFA to accept the string over { a, b } such that the
string begin with “a” and length of the string when divided by 3
results
Here reminder as 2.
Ʃ={a, b} and L = {aa, ab, aaaaa, aaaab, aaaba, aaabb, aabaa, aabab, aabba, … }
Solution a, b δ a b
qx q1 ɸ
a a, b a, b
qx q1 q2 q0 q1 q2 q2
q2 q0 q0
b
ɸ a, b q0 q1 q1
ɸ ɸ ɸ
Deterministic Finite Automata
D FA a c c e p t i n g s t r i n g s b a s e d o n s y m b o l s
Count
D FA A C C E P T I N G S T R I N G S B A S E D O N
S YMBO
Problem LS COUNT
Solving
Construct a DFA to accept the strings that contain even number
of symbols “a” and odd number of symbols “b” over an alphabet
{a,Here
b}.
Ʃ={a, b} and L = {b, aab, baa, aba, abaaa, baaaa, aabaa, aaaba, bbb, babab, …}
Solution a δ a b
q00 q10
a q00 q10 q01
Construct a DFA to accept strings that contain the substring λ over an alphabet {a, b}.