# Designing Deterministic Finite Automata (Set 5)

**Prerequisite:** Designing finite automata

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

**Problem-1:** Construction of a minimal DFA accepting set of strings over {a, b} in which every ‘a’ is followed by a ‘bb’.

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

L1 = {ε, abb, abbabb, bbbbabb, abbabbabbabbabbbb, ..............}

Here as we can see that each string of the language containing ‘a’ is just followed by ‘bb’ but the below language is not accepted by this DFA because some of the string of the below language does not contain ‘a’ just followed by ‘bb’.

L2 = {ba, baab, bbaba, ..............}

The state transition diagram of the language containing ‘a’ just followed by ‘bb’ will be like:

In the above DFA, state ‘v’ is the initial and final state too which on getting ‘b’ as the input it remains in the state of itself and on getting ‘a’ as the input it transit to a normal state ‘W’ which on getting ‘b’ as the input it transit to the normal state ‘X’ which on getting ‘b’ as input it transit to the final state ‘Y’ which on getting ‘b’ as the input it remains in the state of itself and on getting ‘a’ as the input it transit to the normal state ‘W’ which on getting ‘a’ as the input it transit to the dead state ‘Z’ and the state ‘X’ on getting ‘a’ as the input it transit to the same dead state ‘Z’. The state ‘Z’ is called dead state because on getting any input it can not transit to any of the final states ever.

**Problem-2:** Construction of a minimal DFA accepting set of strings over {a, b} in which every ‘a’ is never be followed by ‘bb’.

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

L1 = {ε, a, aa, aabaa, b, bb, bbbbba, ..............}

Here as we can see that each string of the language containing ‘a’ is never be followed by ‘bb’ but the below language is not accepted by this DFA because some of the string of the below language containing ‘a’ is followed by ‘bb’.

L2 = {abb, babbabb, bbaba, ..............}

The state transition diagram of the language containing ‘a’ never be followed by ‘bb’ will be like:

In the above DFA, the state ‘W’ is the initial and final state too which on getting ‘b’ as the input it remains in the state of itself and on getting ‘a’ as the input it transit to the final state ‘X’ which on getting ‘a’ as the input it remains in the state of ‘X’ and getting ‘b’ as the input it transit to the final state ‘Y’ which on getting ‘a’ as the input it transit to another final state ‘X’ and the final state ‘Y’ on getting ‘b’ as the input it transit to the dead state ‘Z’. The state ‘Z’ is called dead state because on getting any input it can not go to any of the final state ever.

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 6)
- Designing Non-Deterministic Finite Automata (Set 3)
- Designing Deterministic Finite Automata (Set 10)
- Designing Deterministic Finite Automata (Set 11)
- Designing Non-Deterministic Finite Automata (Set 4)
- Designing Deterministic Finite Automata (Set 1)
- Designing Deterministic Finite Automata (Set 2)
- Designing Non-Deterministic Finite Automata (Set 5)
- Designing Non-Deterministic Finite Automata (Set 1)
- Designing Deterministic Finite Automata (Set 9)
- Designing Deterministic Finite Automata (Set 4)
- Designing Deterministic Finite Automata (Set 8)
- Designing Deterministic Finite Automata (Set 7)
- Designing Deterministic Finite Automata (Set 3)
- Designing Finite Automata from Regular Expression (Set 5)

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.