![]() |
VOOZH | about |
Prerequisite: Basic Knowledge of Finite Automata
Construction of a minimal NFA accepting a set of strings over {a, b} in which each string of the language starts with 'ab'.
The desired language will be like:
L1 = {ab, abba, abaa, abbb ...........}
Here as we can see that each string of the above language starts with 'ab' and end with any alphabet either 'a' or 'b'. But the below language is not accepted by this NFA because none of the string of below language starts with 'ab'.
L2 = {ba, ba, babaaa..............}
The state transition diagram of the desired language will be like below:
In the above NFA, the initial state 'X' on getting 'a' as the input it transits to a state 'Y'. The state 'Y' on getting 'b' as the input it transits to a final state 'Z'. The final state 'Z' on getting either 'a' or 'b' as the input it remains in the state of itself.
Output:
a
string not accepted
ba
string not accepted
abab
string accepted
ab
string accepted
Construction of a minimal NFA accepting a set of strings over {a, b} in which each string of the language is not starting with 'ab'.
The desired language will be like:
L1 = { 𝝐, a, b, aa, bb, ba, bba, bbaa, ...........}
Here as we can see that each string of the above language is not starting with 'ab' but can end with either 'a' or 'b'.
But the below language is not accepted by this NFA because some of the string of below language starts with 'ab'.
L2 = {ab, aba, ababaab..............}
The state transition diagram of the desired language will be like below:
In the above NFA, the initial state 'X' on getting 'b' as the input it transits to a state 'Y' , and on getting 'a' transit to state 'Z' .The state 'Y' on getting either 'a' or 'b' as the input it transits to a final state 'Y' . The final state 'Z' on getting 'a' moves to the state 'Y' and on 'b' moves to the dead state 'S'.
Output:
epsilon
string accepted
a
string accepted
aa
string accepted
ab
string not accepted
ba
string accepted