1
2
1.Initial state (q0)
2.State after reading 'a' (q1)
3.State after reading 'ab' (q2)
•Start from the initial state (q0).
•When you read 'a', transition to state q1.
•In state q1, if you read 'a' or 'b', stay in state q1.
•If you read 'b' in state q1, transition to state q2.
•In state q2, if you read 'a' or 'b', stay in state q2.
1.Initial state (q0)
3 2.State after reading 'a' (q1)
3.State after reading 'aa' (q2)
4.State after reading 'aab' (q3)
5.Accepting state (q4)
•Start from the initial state (q0).
•When you read 'a', transition to state q1.
•In state q1, if you read 'a', transition to state q2.
•In state q2, if you read 'a', transition to state q3.
•In state q3, if you read 'b', transition to state q4.
States:
4 1.Initial state (q0)
2.State for recognizing 'a' (q1)
3.State for recognizing 'aa*' (q2)
Alphabet: {a, b}
Transitions:
•Start from the initial state (q0).
•When you read 'a', transition to state q1.
•In state q1, if you read 'a' or 'b', stay in state q1 to represent "a."
•In state q1, if you read 'a', transition to state q2 to represent "aa*."
•In state q2, if you read 'a' or 'b', stay in state q2 to continue
recognizing "aa*."
Accepting State: State q1 is the accepting state for strings that match
"a." State q2 is an accepting state for strings that match "aa*."
1.Initial state (q0)
5 2.State after reading '0' (q1)
3.State after reading '1' (q2)
4.State after reading '00' (q3, accepting for "00")
5.State after reading '11' (q4, accepting for "11")
•Start from the initial state (q0).
•When you read '0', transition to state q1.
•When you read '1', transition to state q2.
•In state q1, if you read '0', transition to state q3 (accepting
"00").
•In state q2, if you read '1', transition to state q4 (accepting
"11").
•In state q3 or q4, if you read '0' or '1', stay in the respective
state.
1
States:
1.Initial state (q0)
2.State after reading a '0' (q1)
3.State after reading a '0' following a multiple of 3 characters
(q2, accepting for "00")
Alphabet: {0, 1}
Transitions:
•Start from the initial state (q0).
•When you read '1', stay in state q0 (to represent the substring).
•When you read '0', transition to state q1.
•In state q1, if you read '0', transition to state q2 (recognizing
"00").
•In state q1, if you read '1', go back to state q0 (representing the
substring).
•In state q2, stay in state q2 for '0' or '1'.
2
States:
1.Initial state (q0)
2.State for recognizing 'a' (q1) Accepting States:
3.State for recognizing 'a' (q2) •State q1 for recognizing 'a'.
4.State for recognizing 'a' (q3) •State q2 for recognizing "aa".
5.State for recognizing 'b' (q4) •State q4 for recognizing "aa*b".
6.State for recognizing 'b' (q5) •State q5 for recognizing "a*b".
7.State for recognizing 'b' (q6) •State q6 for recognizing "a".
Alphabet: {a, b}
Transitions:
•Start from the initial state (q0).
•When you read 'a', transition to state q1.
•In state q1, if you read 'a', transition to state q2 (to represent "aa").
•In state q2, if you read 'b', transition to state q4 (to represent "aa*b").
•In state q4, if you read 'b', stay in state q4 (to continue "aa*b").
•In state q4, if you read 'a', transition to state q3 (to recognize "a" in "aa*b").
•In state q3, if you read 'b', transition to state q5 (to represent "a*b").
•In state q5, if you read 'b', stay in state q5 (to continue "a*b").
•In state q5, if you read 'a', transition to state q6 (to recognize "a" in "a*b").
3 States:
1.Initial state (q0)
2.State for recognizing (a + ba)* (q1)
3.State for recognizing b (q2)
4.State for recognizing b (q3)
5.State for recognizing (a + ab)* (q4)
Alphabet: {a, b}
Transitions:
•Start from the initial state (q0).
•When you read 'a', transition to state q1.
•In state q1, if you read 'a' or 'b', stay in state q1 to represent (a + ba)*.
•If you read 'b' in state q1, transition to state q2.
•In state q2, stay in state q2 for 'b' to recognize the first 'b'.
•In state q2, if you read 'a', transition to state q3.
•In state q3, stay in state q3 for 'b' to recognize the second 'b'.
•In state q3, if you read 'a' or 'b', transition to state q4 to represent (a + ab)*.
•In state q4, if you read 'a' or 'b', stay in state q4 to continue recognizing (a + ab)*.
Accepting States:
•State q4 for recognizing (a + ab)* (when you've seen the required number of 'b's).
Transition Table:
1
4 NFA:
States: {q0}
Alphabet: {a, b}
2.NFA for the set {ε}:
NFA:
States: {q0} Alphabet: {a, b}
Transitions: None (no transitions)
Accepting States: q0
3.NFA for the set {(ab)^n | n ∈ N}:
NFA:
States: {q0, q1}
Alphabet: {a, b}
Transitions:
•Start from the initial state (q0).
•When you read 'a', transition to state q1.
•When you read 'b' in state q1, transition back to q0 to repeat
the pattern.
Accepting States: q0
1 2 3
5 States:
1.Initial state (q0)
2.State after reading '0' (q1)
3.Accepting state after reading '01' (q2)
Alphabet: {0, 1}
Transitions:
•Start from the initial state (q0).
•When you read '0', transition to state q1.
•In state q1, if you read '1', transition to the accepting state q2.
•In state q2, if you read '0' or '1', stay in state q2.
Accepting State: State q2 is the accepting state because it
represents strings ending with "01."