Skip to content
Related Articles

Related Articles

Improve Article

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

  • Difficulty Level : Basic
  • Last Updated : 24 Jun, 2019

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’.

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

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.

My Personal Notes arrow_drop_up
Recommended Articles
Page :