- Related Questions & Answers
- Draw DFA which accepts the string starting with ‘ab’.
- Design NFA with Σ = {0, 1} and accept all string of length at least 2.
- JavaScript Strings: Replacing i with 1 and o with 0
- DFA for Strings not ending with “THE” in C++?
- Print all subarrays with 0 sum in C++
- Find all rectangles filled with 0 in Python
- Construct a Turing Machine for language L = {ww | w ∈ {0,1}}
- Construct K Palindrome Strings in C++
- Construct objects from joining two strings JavaScript
- Construct Pushdown automata for L = {0(n+m)1m2n | m, n = 0} in C++
- Replace 0 with null in MySQL?
- Construct Target Array With Multiple Sums in C++
- Can MySQL concatenate strings with ||?
- Construct Pushdown automata for L = {0n1m2m3n | m,n = 0} in C++
- DFA based division

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

A Deterministic Finite automata (DFA) is a collection of defined as a 5-tuples and is as follows −

**M=(Q, Σ, δ,q0,F)**

Where,

- Q: Finite set called states.
- Σ: Finite set called alphabets.
- δ: Q × Σ → Q is the transition function.
- q0 ∈ Q is the start or initial state.
- F: Final or accept state.

The DFA accepts all strings starting with 0

The language L= {0,01,001,010,0010,000101,…}

In this language, all strings start with zero.

The transition diagram is as follows −

**Step 1**− q0 is the initial state on input ‘0’ it goes to q1, which is the final state, and ‘0’ string is accepted.**Step 2**− q0 on ‘1’ goes to q2 which is dead state because for q2 there is no path to reach to the final state.**Step 3**− q1 on input ‘0’ and ‘1’ goes to q1 itself which is the final state.

The transition table is as follows −

State/input symbol | 0 | 1 |
---|---|---|

->q0 | q1 | q2 |

q1 | q1 | q1 |

q2 | - | - |

Construct DFA for the language accepting strings starting with ‘101’

- All strings start with substring “101”.
- Then the length of the substring = 3.

Therefore, Minimum number of states in the DFA = 3 + 2 = 5.

The minimized DFA has five states.

The language L= {101,1011,10110,101101,.........}

The transition diagram is as follows −

**Step 1**− q0 is an initial state on input ‘1’ goes to q1 and on input ‘0’ leads to a dead state.**Step 2**− q1 on input ‘0’ goes to q2 and on ‘1’ goes to dead state.**Step 3**− q2 on input ‘1’ goes to qf which is the final state, and on ‘0’ goes to dead state.**Step 4**− qf is the final state, on input ‘1’ and ‘0’ it goes to qf itself.

Advertisements