Examples of DFA
Examples of DFA
com)
Examples of DFA
This lecture discusses more than 30 examples of DFA. But you make sure that you have already covered
the topic of DFA (https://cstaleem.com/deterministic-finite-automaton-dfa). There are six different
categories are selected for examples of DFA, which are listed below
Contains string
Specific Length
Divisibility
Example 1:
Design a DFA (https://cstaleem.com/deterministic-finite-automata) over ∑ = {0, 1} that accepts the only
input a string “10”.
Solution:
In the above example, the language contains only one string given below
L= {10}
Solution:
L= {aaab}
Example:3
Construct DFA, which accept all the string over alphabets ∑ {0,1} that start with “0”.
Solution:
Let’s draw the DFA, which accepts all the strings starting with “0”.
Example:4
Construct DFA, which accept all the string over alphabets ∑ {0,1} that start with “01”.
Solution:
Let’s draw the DFA which accepts all the strings of the above language
Example:5
Construct DFA, which accepts all the strings over alphabets ∑ {0,1} that ends with “0”.
Solution:
Let’s draw the DFA, which accepts all the strings that end with “0”.
Example:6
Construct DFA, which accept all the string over alphabets ∑ {0,1} that end with “10”.
Solution:
DFA, which accepts all the strings that end with “10” is given under
Example:7
Construct a DFA with sigma ∑ = {0, 1}, accepts those string which starts with one and ends with 0.
Solution:
The following diagram represents the DFA accepter for the above language.
Note: The above automata machine does not accept those strings that start and end with the same input
as “10001”.
Example:8
Construct DFA, which accepts all the strings over ∑ {0,1} where each contains “0”.
Solution:
Let’s draw the DFA, which accepts all the strings containing “0”.
Example:9
Construct DFA, which accept all the string over alphabets ∑ {0,1} where each string contains “00”.
Solution:
Let’s draw the DFA which accepts all the strings of the above language
Example:10
Construct a DFA with sigma ∑ = {0, 1}, accepts all strings that contain three consecutive 0’s.
Solution:
DFA, which accepts all the strings that contain three consecutive 0’s, is given under
Example:11
Construct DFA, which accept all the string over alphabets ∑ {0,1} where each string contains “101” as a
substring.
Solution:
Let’s draw the DFA which accepts all the strings of the above language
Example:12
Construct DFA, which accept all the string over alphabets ∑ {0,1} where the length of each string is
exactly 2.
Solution:
The following diagram represents the DFA accepter for the language language where the length of each
string is exactly two.
Example:13
Construct DFA, which accept all the string over alphabets ∑ {0,1} where the length of each string is ≥ 2.
Solution:
L = {00, 01, 10, 11, 000, 011, 010, 100, 101, 111, 0000, ……, }
The following diagram represents the DFA accepter for the language language where the length of each
string is ≥ 2.
Example:14
Construct DFA, which accept all the string over alphabets ∑ {0,1} where the length of each string is ≤ 2
Solution:
The following diagram represents the DFA accepter for the language where the length of each string is ≤
2
Example:15
Construct DFA, which accept all the string over alphabets ∑ {0,1} where the length of each string is
EVEN.
Solution:
The following diagram represents the DFA accepter for the language where the length of each string is
even.
Example:16
Construct DFA, which accept all the string over alphabets ∑ {0,1} where the length of each string is
ODD.
Solution:
The following diagram represents the DFA accepter for the language where the length of each string is
odd.
Example:17
Construct DFA, which accepts all the string over alphabets ∑ {0,1} where binary integers divisible by 3
Solution:
The following diagram represents the DFA accepter for the language where binary integers are divisible
by three.
Example:18
Construct DFA, which accepts all the string over alphabets ∑ {0,1} where binary integers divisible by 4
Solution:
The following diagram represents the DFA accepter for the language where binary integers are divisible
by four.
DFA Example 19:
Draw a DFA for the language that accepts strings containing neither ’00’ nor ’11’ as a substring over the
input alphabet ∑ = {0, 1}.
Solution:
The given question provides the following language (L) and DFA diagram
L={0,1,10,010,1010,01010,101010,0101010,10101010,010101010,…..}
Solution:
The given question provides the following language (L) and DFA diagram
L={001,110,1110,0010,0001,1101,…..}
DFA Example 21
Construct a DFA with sigma ∑ = {0, 1} for the language accepting strings ending in either ’01’ or ’10’.
Solution:
The given question provides the following language (L) and DFA diagram
Solution:
The given question provides the following language (L) and DFA diagram
DFA Example 23
Design a DFA with sigma ∑ = {0, 1} for the language accepting strings containing at least two ‘0’.
Solution:
The given question provides the following language (L) and DFA diagram
L={00,001,000,0011,0010,0001,0000,1100, 1001…..}
DFA Example 24
Draw a DFA with sigma ∑ = {0, 1} for the language accepting strings containing at most two ‘0’.
Solution:
The given question provides the following language (L) and DFA diagram
L={0,1,10,01,001,1001,1011,1101, …..}
DFA Example 25
Construct a DFA with sigma ∑ = {0, 1} for the language accepting strings starting and ending with ‘0’
always.
Solution:
The given question provides the following language (L) and DFA diagram
DFA Example 26
Design a DFA with sigma ∑ = {0, 1} for the language accepting strings starting and ending with different
characters.
Solution:
The given question provides the following language (L) and DFA diagram
L={01,10,011,100,…..}
DFA Example 27
Construct a DFA with sigma ∑ = {0, 1} for the language accepting strings starting and ending with the
same characters.
Solution:
The given question provides the following language (L) and DFA diagram
L={00,11,101,010,…..}
DFA Example 28
Design a DFA with sigma ∑ = {0, 1} for the language accepting strings containing an odd number of total
zeros (or odd binary numbers strings).
Solution:
The given question provides the following language (L) and DFA diagram
DFA Example 29
Construct a DFA with sigma ∑ = {0, 1} for the language accepting strings starting with ‘00’ or ’11’
Solution:
The given question provides the following language (L) and DFA diagram
L={00,11,000,111, 110,0001,0010, …..}
DFA Example 30
Construct a DFA with sigma ∑ = {0, 1} for the language accepting strings ending with ‘0011’.
Solution:
The given question provides the following language (L) and DFA diagram
L={0011,00011,10011,110011,000011,…..}
DFA Example 31
Construct a DFA with sigma ∑ = {0, 1} for the language accepting strings ending with ‘0110’ .
Solution:
The given question provides the following language (L) and DFA diagram
L={0110,10110,00110,110110,000110,…..}
DFA Example 32
Construct a DFA with sigma ∑ = {0, 1} for the language accepting strings ending with ‘00’.
Solution:
The given question provides the following language (L) and DFA diagram
L={00,000,0100,01100,01000…..}
Example:33
Design a DFA with sigma ∑ = {a, b}, accepts those strings that have an even number of “0’s” and an
even number of “1’s”.
Solution:
In Above DFA,
If state q1 becomes final instead of q0, DFA will accept all those strings with Odd “0” and even “1”.
(https://cstaleem.com/deterministic-finite-autom cstaleem.com/non-deterministic-finite-automata-nfa)
And if state q2 becomes final instead of q0, then DFA will accept all those strings with even “0” and
odd “1”.
Introduction to Automata
And If state q3 becomes final instead of q0, then DFA will accept all those strings with odd “0” and
Finiteodd “1”.
Automata
Regular Expressions
Derivation in Automata
Turing Machine
(https://cstaleem.com)
Empowering learners with accessible, engaging computer science education to inspire innovation and
mastery.
Useful Links
ABOUT(HTTPS://CSTALEEM.COM/ABOUT-US)
BLOG(HTTPS://CSTALEEM.COM/BLOG)
CONTACT US(HTTPS://CSTALEEM.COM/CONTACT-US)
BECOME A (HTTPS://CSTALEEM.COM/BECOME-A-
CONRIBUTOR CONTRIBUTER)
SUGGEST A TOPIC(HTTPS://CSTALEEM.COM/SUGGEST-A-TOPIC)
Legal Pages
REVIEWS GUARANTEE(HTTPS://CSTALEEM.COM/REVIEWS-GUARANTEE)
COMMUNITY GUIDELINES
CORRECTIONS POLICY AND PRACTICE
COOKIES POLICY(HTTPS://CSTALEEM.COM/COOKIES-POLICY)
OUR ETHICS(HTTPS://CSTALEEM.COM/OUR-ETHICS)
DISCLAIMER(HTTPS://CSTALEEM.COM/DISCLAIMER)
GDPR COMPLIANCE(HTTPS://CSTALEEM.COM/GDPR-COMPLIANCE)
PRIVACY POLICY(HTTPS://CSTALEEM.COM/PRIVACY-POLICY)
TERMS AND (HTTPS://CSTALEEM.COM/TERMS-AND-
CONDITIONS CONDITIONS)
@Copyright 2024 www.cstaleem.com All rights reserved