The Wayback Machine - https://web.archive.org/web/20240819212910/https://www.geeksforgeeks.org/practice-problems-finite-automata/
Open In App

Practice problems on finite automata

Last Updated : 28 Aug, 2019
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Que-1: Draw a deterministic and non-deterministic finite automate which accept 00 and 11 at the end of a string containing 0, 1 in it, e.g., 01010100 but not 000111010.

Explanation – Design a DFA and NFA of a same string if input value reaches the final state then it is acceptable otherwise it is not acceptable.
NFA of the given string is as follows:

DFA of the given string is as follows:

Here, q0 shows the initial state, q1 and q2 are the transition states, and q3 and q4 are the final states.

Note – NFA and DFA both have same power that means if NFA can recognized an language L then DFA can also be defined to do so and if DFA can recognized an language L then NFA can also be defined to do so.

Que-2: Draw a deterministic and non-deterministic finite automata which accept a string containing “the” anywhere in a string of {a-z}, e.g., “there” but not “those”.

Explanation – Design a DFA and NFA of a same string if input value reaches the final state then it is acceptable otherwise it is not acceptable. It is applicable for all the DFA and NFA. Since, NFA is quit easier then DFA, so first make its NFA and then go through the DFA.
NFA of the given string is as follows:

DFA of the given string is as follows:

Here, q0 shows the initial state, q1 and q2 are the transition states, and q3 is the final state.

Que-3: Draw a deterministic and non-deterministic finite automata which accept a string containing “ing” at the end of a string in a string of {a-z}, e.g., “anything” but not “anywhere”.

Explanation – Design a DFA and NFA of a same string if input value reaches the final state then it is acceptable otherwise it is not acceptable. It is applicable for all the DFA and NFA.
NFA of the given string is as follows:

DFA of the given string is as follows:

Here, q0 shows the initial state, q1 and q2 are the transition states, and q3 is the final state.



Similar Reads

Practice problems on finite automata | Set 2
Que-1: Draw a deterministic and non-deterministic finite automate which either starts with 01 or end with 01 of a string containing 0, 1 in it, e.g., 01010100 but not 000111010. Explanation - Draw a DFA and NFA of same language whose strings only reach to the final state containing either 01 at start or at the end. If anything else is come then com
3 min read
Difference between Pushdown Automata and Finite Automata
Pushdown Automata: A Pushdown automata (PDA) is a finite state machine with an added stack storage. Additional stack is used in making the decision for transitions apart from input symbols and current state. It contains the following 7 tuples: Finite Automata: A Finite Automata is a mathematical model of any machine by which we can calculate the tr
2 min read
Proving elements of a finite group is finite
To Prove : The order of every element of a finite group is finite and is less than or equal to the order of the group. Proof : Suppose G is a finite group, the composition being denoted multiplicatively. Suppose a ∈ G, consider all positive integral powers of a i.e., a, a2, a3, ...... All these are elements of G, by closure axiom. Since G has a fin
2 min read
Generating regular expression from Finite Automata
Prerequisite - Introduction of FA, Regular expressions, grammar and language, Designing FA from Regular Expression There are two methods to convert FA to the regular expression: 1. State Elimination Method:Step 1 - If the start state is an accepting state or has transitions in, add a new non-accepting start state and add an ₮-transition between the
3 min read
Theory of Computation | Regular languages and finite automata | Question 2
What is the complement of the language accepted by the NFA shown below? (A) A (B) B (C) C (D) D Answer: (B) Explanation: Quiz of this QuestionPlease comment below if you find anything wrong in the above post
1 min read
Designing Finite Automata from Regular Expression (Set 6)
Prerequisite: Finite automata, Regular expressions, grammar and language, Designing finite automata from Regular expression (Set 5) In the below article, we shall see some Designing of Finite Automata form the given Regular Expression- Regular Expression 1: Regular language, L1 = a(a+b)* The language of the given RE is, {aaa, aba, baa, bba} Strings
3 min read
Finite Automata with Output (Set 6)
Prerequisite: Mealy and Moore Machines, Difference between Mealy machine and Moore machine In this article, we will see some designing of Finite Automata with Output, i.e., Moore and Mealy machines. Problem: Construction of the machines that take set of all string over {0, 1} as input and produce 'A' as output if the input contains '101' as the sub
2 min read
Finite Automata with Output (Set 5)
Prerequisite: Mealy and Moore Machines, Difference between Mealy machine and Moore machine In this article, we will see some designing of Finite Automata with Output i.e, Moore and Mealy machines. Problem: Construction of the machines that take set of all string over {0, 1} as input and produce 'A' as output if the input contains '1' as the substri
2 min read
Reversing Deterministic Finite Automata
Prerequisite – Designing finite automata Reversal: We define the reversed language [Tex]L^R \text{ of } L [/Tex] to be the language [Tex]L^R = \{ w^R \mid w \in L \} [/Tex], where [Tex]w^R := a_n a_{n-1} \dots a_1 a_0 \text{ for } w = a_0 a_1 \dots a_{n-1} a_n [/Tex] Steps to Reversal: Draw the states as it is.Add a new single accepting stateMake t
4 min read
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,
3 min read
Designing Deterministic Finite Automata (Set 9)
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 a set of strings over {a, b} in which {abwa / wε{a, b}*}. Here 'w' is the substring containing alphabets over any number of 'a' and 'b' ranging from zero to infinity.
4 min read
Designing Deterministic Finite Automata (Set 6)
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 anbm, where n and m is greater than or equal to 1. Explanation: The desired language will be like: L1 = {ab, aab, abb, aabb, aaabbb, aaabbb
3 min read
Finite Automata with Output (Set 3)
Prerequisite: Mealy and Moore Machines, Difference between Mealy machine and Moore machine In this article, we will see some designing of Finite Automata with Output i.e, Moore and Mealy machines. Problem: Construction of the machines that take set of all string over {a, b} as input and count number of substring 'a'. That is here we have, Ε
2 min read
Finite Automata with Output (Set 11)
Prerequisite: Mealy and Moore Machines, Difference between Mealy machine and Moore machine In this article, we will see some designing of Finite Automata with Output i.e, Moore and Mealy machines. Problem: Construction of the machines that take the binary number {0, 1} as input and produce 1's complement of that number as output. Here the assumptio
4 min read
Designing Finite Automata from Regular Expression (Set 2)
Prerequisite: Finite automata, Regular expressions, grammar and language. Designing finite automata from Regular expression In the below article, we shall see some Designing of Finite Automata form the given Regular Expression- Regular Expression 1: Φ (Phi). The language of the given RE is L1 = {} i.e, empty string. Its finite automata will be
3 min read
Designing Finite Automata from Regular Expression (Set 3)
Prerequisite: Finite automata, Regular expressions, grammar and language, Designing finite automata from Regular expression (Set 2) In the below article, we shall see some Designing of Finite Automata form the given Regular Expression. Regular Expression 1: 'ab*' ('a' followed by any number of 'b'). The language of the given RE is, L1 = {a, ab, abb
3 min read
Designing Finite Automata from Regular Expression (Set 4)
Prerequisite: Finite automata, Regular expressions, grammar and language, Designing finite automata from Regular expression (Set 3) In the below article, we shall see some Designing of Finite Automata form the given Regular Expression- Regular Expression 1: Regular language, L1 = (a+b)(a+b) The language of the given RE is, {aa, ab, ba, bb} Length o
3 min read
Designing Finite Automata from Regular Expression (Set 5)
Prerequisite: Finite automata, Regular expressions, grammar and language, Designing finite automata from Regular expression (Set 4) In the below article, we shall see some Designing of Non-deterministic Finite Automata form the given Regular Expression- As NFA can be changed to corresponding DFA. Regular Expression 1: Regular language, L1 = ((a+b)(
3 min read
Designing Finite Automata from Regular Expression (Set 7)
Prerequisite: Finite automata, Regular expressions, grammar and language, Designing finite automata from Regular expression (Set 6) In the below article, we shall see some Designing of Finite Automata form the given Regular Expression- Regular Expression 1: Regular language, L1 = b*aa(a+b)*+b*ab*aa(a+b*) The language of the given RE is- {aaa, baa,
3 min read
Designing Finite Automata from Regular Expression (Set 8)
Prerequisite: Finite automata, Regular expressions, grammar and language, Designing finite automata from Regular expression (Set 7) In the below article, we shall see some Designing of Finite Automata form the given Regular Expression- Regular Expression 1: Regular language, L1 = {an | n≥ 1} The language of the given RE is- {a, aa, aaa, ........
2 min read
Compound Finite Automata (FA)
Prerequisite - Finite Automata (FA) Compound FA is the resultant DFA formed after performing operation (∪, ∩, -) on given DFAs D1 and D2. D1 = (Q1, ∑, δ, q1, F1) and D2 = (Q2, ∑, δ, q2, F2) Where, Q1 and Q2: Set of finite states of DFA D1 and D2 respectively. ∑: Input alphabet contain finite number of input symbols.
2 min read
Difference between Finite Automata and Turing Machine
1. Finite Automata: The finite automata or finite state machine is an abstract machine that has five elements or tuples. It has a set of states and rules for moving from one state to another but it depends upon the applied input symbol. Basically, it is an abstract model of a digital computer. The following figure shows some essential features of g
3 min read
Equivalence Of F.S.A (Finite State Automata)
An Automaton is a machine that has a finite number of states. Any Two Automaton is said to be equivalent if both accept exactly the same set of input strings. Two Automaton are equivalent if they satisfy the following conditions : 1. The initial and final states of both the automatons must be same.2. Every pair of states chosen is from a different
3 min read
Designing finite automata for various operations like 1's complement, 2's complement
Transducers in Finite Automata(FA) means FA with Output.There are two types of Machines for FA with Output. 1. Mealy Machine : It is FA in which output is associated with each transition. (that means output depends on state and input).2. Moore Machine : It is FA in which output is associated with each state. (that means output depends on state only
4 min read
Design finite automata from regular expressions
Prerequisite - Finite automata, Regular expressions, grammar, and language. In this article, we will see some popular regular expressions and how we can convert them to finite automata (NFA and DFA). Let's discuss it one by one. Overview :Let a and b are input symbols and r is the regular expression. Now we have to design NFA as well as DFA for eac
3 min read
Conversion of Regular Expression to Finite Automata
As the regular expressions can be constructed from Finite Automata using the State Elimination Method, the reverse method, state decomposition method can be used to construct Finite Automata from the given regular expressions. Note: This method will construct NFA (with or without Îĩ-transitions, depending on the expression) for the given regular exp
3 min read
Introduction of Finite Automata
Finite Automata(FA) is the simplest machine to recognize patterns.It is used to characterize a Regular Language, for example: /baa+!/.Also it is used to analyze and recognize Natural language Expressions. The finite automata or finite state machine is an abstract machine that has five elements or tuples. It has a set of states and rules for moving
5 min read
Designing Finite Automata from Regular Expression (Set 1)
In this article, we will see some popular regular expressions and how we can convert them to finite automata. Even number of a's : The regular expression for even number of a's is (b|ab*ab*)*. We can construct a finite automata as shown in Figure 1. The above automata will accept all strings which have even number of a’s. For zero a’s, it will be i
3 min read
Designing Deterministic Finite Automata (Set 7)
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 a n b m c l , where n, m and l is greater than or equal to 0. Explanation: The desired language will be like: L1 = {Îĩ, a, aa, aaa, b, bb, b
6 min read
Designing Deterministic Finite Automata (Set 2)
Prerequisite - Designing finite automata, previous article: Designing Deterministic Finite Automata (Set 1) In this article, we will see some designing of Deterministic Finite Automata (DFA). Problem-1: Construction of a DFA for the set of string over {a, b} such that length of the string |w| is divisible by 2 i.e, |w| mod 2 = 0. Explanation - The
7 min read
three90RightbarBannerImg