Worksheet2 - NFA - Solutions
Worksheet2 - NFA - Solutions
OBJECTIVES:
Introduce Non-deterministic Finite Automata (NFA).
Understand NFA transition graphs.
Determine whether or not a string is accepted by an NFA.
Describe the language accepted by an NFA (verbally or formally).
Q1. Indicate whether or not each string is accepted by the given machine M.
1
0 1
q0 q1 q2
0, 1 0, λ
000 1
0000 0
101 1
0100 1
01001 1
10010 0
Q2. Construct an NFA that accepts the following language on the alphabet Σ = {a, b}.
L = {w: w ϵ {a, b}*, |w| = 2}.
a, b a, b
q0 q1 q2
Q3. Construct an NFA that accepts the following language on the alphabet Σ = {a, b}.
L = {w: w ϵ {a, b}*, |w| ≥ 2}.
a, b
a, b a, b
q0 q1 q2
Q4. Construct an NFA that accepts the following language on the alphabet Σ = {a, b}.
L = {aw: w ϵ {a, b}*}, i.e., strings which start with a.
a, b
a
q0 q1
Q5. Construct an NFA that accepts the following language on the alphabet Σ = {a, b}.
L = {wa: w ϵ {a, b}*}, i.e., strings which end with a.
a, b
a
q0 q1
Q6. Construct an NFA that accepts the following language on the alphabet Σ = {a, b}.
L = {wav: w, v ϵ {a, b}*}, i.e. strings which contain at least one 'a'.
a, b a, b
a
q0 q1
Q7. Write down the formal language that the following NFA accepts, where Σ = {a, b}.
a, b a, b
q0 q1 q2
Q8. Write down the formal language that the following NFA accepts, where Σ = {a, b}.
a, b
a b
q0 q1 q2
Q9. Write down the formal language that the following NFA accepts, where Σ = {a, b}.
a, b a, b
a b
q0 q1 q2
Q10. Write down the formal language that the following NFA accepts, where Σ = {a, b}.
a, b
a b
q0 q1 q2
Q11. Write down the formal language that the following NFA accepts, where Σ = {a, b}.
a a
q1 q2 q3
a
q0
a
a
q4 q5
L = { a3 } U { a2n : n ≥ 1 }