**Problem Statement :**

Design and construct Non deterministic finite automata machine that accepts the string over input alphabets (a, b, c) with atleast one of the (input symbols) have odd number of presence in the string.

**Example :**

aaabbbb, ababac, ababababccc ...

**Approach:**

- Construct Initial state with the mark –>.
- Make transitions from one state to another on every input alphabet accordingly.
- check if there is requirement of constructing self loop or not.
- Mark final state with two concentric circles.

**Designing NFA step-by-step :**

**Step-1:**

Create an initial state “A” which transits to three different states as “B”, “C”, “D” for null.

**Step-2:**

On state “B” if input alphabet is ‘a’ then make transitions of ‘a’ from state “B” to “X”, and if input alphabets on state “B” are ‘b’ or ‘c’ then make self loop of ‘b’ and ‘c’ on state “B” itself.

**Step-3:**

On state “X” input alphabets ‘b’ and ‘c’ are transits to state “X” itself but transition of ‘a’ is going from state “X” to state “B”.

**Step-4:**

On state “C” if input alphabet is ‘b’ then make transitions of ‘b’ from state “B” to “Y”, and if input alphabets on state “C” are ‘b’ or ‘c’ then make self-loop of ‘b’ and ‘c’ on state “C” itself And On state “Y” input alphabets ‘a’ and ‘c’ are transits to state “Y” itself but transition of ‘b’ is going from state “Y” to state “B”.

**Step-5:**

On state “D” if input alphabet is ‘c’ then make transitions of ‘c’ from state “D” to “Z”, and if input alphabets on state “D” are ‘b’ or ‘a’ then make self loop of ‘b’ and ‘a’ on state “D” itself. On state “Z” input alphabets ‘a’ and ‘b’ are transits to state “Z” itself but transition of ‘c’ is going from state “Z” to state “D”.

**Step-6:**

State “X” ensures the odd number of ‘a’, state”Y” ensures the odd number of ‘b’ and state “Z” ensures the odd number of ‘c’. So mark these here states as final states.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

## Recommended Posts:

- Conversion of Epsilon-NFA to NFA
- NFA to accept strings that has atleast one character occurring in a multiple of 3
- Hypothesis (language regularity) and algorithm (L-graph to NFA) in TOC
- Conversion from NFA to DFA
- Program to Implement NFA with epsilon move to DFA Conversion
- Regular expression to ∈-NFA
- NFA machines accepting all strings that ends or not ends with substring 'ab'
- Difference between DFA and NFA
- NFA which accepts set of strings over an alphabet {0, 1, 2} such that the final digit has appeared before
- DFA for exactly one of a and at least one of b
- DFA of a string with at least two 0’s and at least two 1’s
- Build a DFA to accept a binary string containing "01" i times and "1" 2j times
- Program to construct DFA accepting odd number of 0s and odd number of 1s
- DFA for accepting the language L = {a
^{n}b^{m}| n+m=odd} - DFA machines accepting odd number of 0’s or/and even number of 1’s
- DFA for accepting the language L = { a
^{n}b^{m}| n+m=even } - NPDA for accepting the language L = {a
^{n}b^{m}c^{n}| m,n>=1} - NPDA for accepting the language L = {a
^{2m}b^{3m}| m ≥ 1} - Context-sensitive Grammar (CSG) and Language (CSL)
- Relationship between grammar and language in Theory of Computation

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.