- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Construct DFA with Σ= {0,1} accepts all strings with 0.
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.
Example 1
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.
Transition diagram
The transition diagram is as follows −
Explanation
- 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.
Transition table
The transition table is as follows −
State/input symbol | 0 | 1 |
---|---|---|
->q0 | q1 | q2 |
q1 | q1 | q1 |
q2 | - | - |
Example 2
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 −
Explanation
- 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.
- Related Articles
- Construct DFA of alternate 0’s and 1’s
- Construct DFA for strings not ending with "THE"
- Convert RE 1(0+1)*0 into equivalent DFA.
- C Program to construct a DFA which accepts L = {aN | N ≥ 1}
- JavaScript Strings: Replacing i with 1 and o with 0
- Construct ∈-NFA of Regular Language L = 0(0+1)*1
- Design DFA for language over {0,1} accepting strings with odd number of 1’s and even number of 0’s
- Draw DFA which accepts the string starting with ‘ab’.
- Design a DFA of a string with at least two 0’s and at least two 1’s
- Print all subarrays with 0 sum in C++
- Find all rectangles filled with 0 in Python
- Contiguous subarray with 0 and 1 in JavaScript
- Construct ∈-NFA of Regular Language L = (0+1)*(00+ 11)
- DFA for Strings not ending with “THE” in C++?
- Find the integer whose product with $-1$ is 0?

Advertisements