# Designing Non-Deterministic Finite Automata (Set 4)

**Prerequisite:** Finite Automata Introduction

In this article, we will see some designing of Non-Deterministic Finite Automata (NFA).

**Problem-1:** Construction of a minimal NFA accepting a set of strings over {a, b} in which each string of the language contain ‘a’ as the substring.

**Explanation:** The desired language will be like:

L1 = {ab, abba, abaa, ...........}

Here as we can see that each string of the above language contains ‘a’ as the substring. But the below language is not accepted by this NFA because some of the string of below language does not contain ‘a’ as the substring.

L2 = {bb, b, bbbb, .............}

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 final state ‘Y’ and on getting ‘b’ as the input it remains in the state of itself. The final state ‘Y’ on getting either ‘a’ or ‘b’ as the input it remains in the state of itself. Refer for DFA of above NFA.

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

**Explanation:** The desired language will be like:

L1 = {b, bb, bbbb, ...........}

Here as we can see that each string of the above language is not containing ‘a’ as the substring But the below language is not accepted by this NFA because some of the string of below language is containing ‘a’ as the substring.

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

The state transition diagram of the desired language will be like below:

In the above NFA, the initial and final state ‘Y’ on getting ‘b’ as the input it remains in the state of itself.

GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details

## Recommended Posts:

- Designing Deterministic Finite Automata (Set 4)
- Designing Deterministic Finite Automata (Set 3)
- Designing Deterministic Finite Automata (Set 1)
- Designing Deterministic Finite Automata (Set 5)
- Designing Deterministic Finite Automata (Set 9)
- Designing Deterministic Finite Automata (Set 2)
- Designing Non-Deterministic Finite Automata (Set 3)
- Designing Deterministic Finite Automata (Set 11)
- Designing Non-Deterministic Finite Automata (Set 1)
- Designing Non-Deterministic Finite Automata (Set 5)
- Designing Deterministic Finite Automata (Set 7)
- Designing Deterministic Finite Automata (Set 8)
- Designing Deterministic Finite Automata (Set 10)
- Designing Deterministic Finite Automata (Set 6)
- Designing Finite Automata from Regular Expression (Set 4)

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.