Open In App

NFA machines accepting all strings that ends or not ends with substring ‘ab’

Improve
Improve
Like Article
Like
Save
Share
Report

Prerequisite: Finite Automata Introduction

Problem-1:
Construction of a minimal NFA accepting a set of strings over {a, b} in which each string of the language ends with ‘ab’.

Explanation:
The desired language will be like:

L1 = {ab, abbab, abaab, ...........}

Here as we can see that each string of the above language ends with ‘ab’ but the below language is not accepted by this NFA because some of the string of below language does not end with ‘ab’.

L2 = {bba, abb, aaabbbb, .............}

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 either remains in the state of itself or transit to a state ‘Y’ and on getting ‘b’ as the input it remains in the state of itself. The state ‘Y’ on getting ‘b’ as the input it transmits to a final state ‘Z’.

Problem-2:
Construction of a minimal NFA accepting a set of strings over {a, b} in which each string of the language is not ending with ‘ab’.

Explanation: The desired language will be like:

L1 = {bba, abb, aaabbbb, .............}

Here as we can see that each string of the above language is not ending with ‘ab’ but the below language is not accepted by this NFA because some of the string of below language is ending with ‘ab’.

L2 = {ab, abab, ababaab..............}

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 remains in the state of itself and on getting ‘b’ as the input it transmits to a state ‘Y’. The state ‘Y’ on getting ‘b’ as the input it either remains in the state of itself or transmits to a final state ‘Z’. The final state ‘Z’ on getting ‘a’ as the input it remains in the state of itself.


Last Updated : 24 Jun, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads