Open In App

Concatenation process in DFA

Last Updated : 04 Jan, 2022
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Prerequisite – Designing finite automata 
Designing a DFA for the set of string over {a, b} such that string of the language start with “a” and end with “b”. There two desired language will be formed: 

L1 = {a, aab, aabab, .......}
L2 = {b, bbab, bbabab, .......} 

In L1, starting element is “a” and in L2, ending element is b. 

State Transition Diagram for the language L1: 

This DFA accepts all the string which starts with “a”. Here, state C is the final state and B is the dead state this is called so because after getting any alphabet this state will never go to final state. 

State Transition Diagram for the language L2: 

This DFA accepts all the string ending with alphabet “b”. Here, State B is called final state. 

Now, Taking the concatenation of L1 and L2 language which gives the final result of the language which starts with “a” and end with “b”. 

State Transition Diagram of L1.L2 i.e, L1 concat L2:  

This DFA accept all the string which start with a and end with b. Here, State C is the final state and D is the dead state this is called so because after getting any input alphabet it will never go to final state.
 



Next Article

Similar Reads

Union process in DFA
Prerequisite - Designing finite automata To perform the union operation on two deterministic finite automata (DFAs), the following steps can be taken: Create a new DFA with a new set of states, consisting of all the states from both original DFAs.Define the initial state of the new DFA to be the tuple (q1, q2), where q1 and q2 are the initial state
5 min read
Complementation process in DFA
Prerequisite – Design a Finite automata Suppose we have a DFA that is defined by ( Q, [Tex]\Sigma [/Tex], [Tex]\delta [/Tex], q0, F ) and it accepts the language L1. Then, the DFA which accepts the language L2 where L2 = ̅L1', will be defined as below: ( Q, [Tex]\Sigma[/Tex], [Tex]\delta[/Tex], q0, Q-F ) The complement of a DFA can be obtained by m
2 min read
DFA for accepting the language L = { anbm | n+m=even }
Design a deterministic finite automata(DFA) for accepting the language L =[Tex] {a^n b^{m} | m+n=even} [/Tex]For creating DFA for language, L = { a^n b^m ; n+m=even } use elementary mathematics, which says- even + even = even and odd + odd = even Examples: Input: a a b b // n = 2, m = 2, 2 + 2 = 4 (even) Output: ACCEPTED Input: a a a b b b b // n =
15 min read
DFA in LEX code which accepts even number of zeros and even number of ones
Lex is a computer program that generates lexical analyzers, which is commonly used with the YACC parser generator. Lex, originally written by Mike Lesk and Eric Schmidt and described in 1975, is the standard lexical analyzer generator on many Unix systems, and an equivalent tool is specified as part of the POSIX standard. Lex reads an input stream
6 min read
DFA for Strings not ending with "THE"
Problem - Accept Strings that not ending with substring "THE". Check if a given string is ending with "the" or not. The different forms of "the" which are avoided in the end of the string are: "THE", "ThE", "THe", "tHE", "thE", "The", "tHe" and "the" All those strings that are ending with any of the above mentioned forms of "the" are not accepted.
12 min read
DFA of a string with at least two 0’s and at least two 1’s
Problem - Draw deterministic finite automata (DFA) of a string with at least two 0’s and at least two 1’s. The first thing that come to mind after reading this question us that we count the number of 1's and 0's. Thereafter if they both are at least 2 the string is accepted else not accepted. But we do not have any concept of memory in a DFA so we
3 min read
DFA machines accepting odd number of 0’s or/and even number of 1’s
Prerequisite - Designing finite automata Problem - Construct a DFA machine over input alphabet [Tex]\sum_[/Tex]= {0, 1}, that accepts: Odd number of 0’s or even number of 1’s Odd number of 0’s and even number of 1’s Either odd number of 0’s or even number of 1’s but not the both together Solution - Let first design two separate machines for the two
3 min read
Program to construct a DFA which accepts the language having all 'a' before all 'b'
Given a string S, the task is to design a Deterministic Finite Automata (DFA) for accepting the language L = {aNbM | N ≥ 0, M ≥ 0, N+M ≥ 1}. , i.e., a regular language L such that all 'a' occur before the first occurrence of 'b' {a, ab, aab, bb..., }. If the given string follows the given language L, then print “Accepted”. Otherwise, print “Not Acc
8 min read
DFA for accepting the language L = {an bm | n+m=odd}
Design a deterministic finite automata (DFA) for accepting the language [Tex]L = \{a^nb^m | \text{m+n=odd}\} [/Tex]For creating DFA for language L = {an bm | n+m=odd} use elementary mathematics which says, odd + even = odd, and even+odd = odd Examples: Input: a a b b b Output: ACCEPTED // n = 2, m = 3, 2 + 3 = 5 (odd) Input: a a a b b b Output: NOT
14 min read
Cross Product Operation in DFA
Prerequisite: Designing finite automata Let’s understand the cross product operation in Deterministic Finite Automata (DFA) with help of the below example- Designing a DFA for the set of string over {a, b} such that string of the language contains even number of a's and b's then desired language will be like below- L = {ε, aa, bb, abab, aab
2 min read
DFA of a string in which 3rd symbol from RHS is ‘a’
Prerequisite – Finite Automata Introduction, DFA of a string in which 2nd symbol from RHS is ‘a’ Problem – Draw deterministic finite automata (DFA) of the language containing the set of all strings over {a, b} in which the 3rd symbol from RHS is ‘a’. The strings in which 3rd last symbol is “a” are: aaa, aab, aaab, aaaa, aabbaaa, bbbaba etc The DFA
2 min read
Program to construct a DFA which accept the language L = {anbm | n mod 2=0, m≥1}
Prerequisite - Finite Automata Introduction Problem: Design a deterministic finite automata (DFA) for accepting the language [Tex]L = \{a^nb^m | n\mod 2=0, m \geq 1\}[/Tex] Regular expression for above language L is, L = (aa)*.b+ Examples: Input: a a b b b Output: ACCEPTED // n = 2 (even) m=3 (>=1) Input: a a a b b b Output: NOT ACCEPTED // n =
10 min read
DFA for strings not containing consecutive two a's and starting with 'a'
Prerequisite - Finite Automata Introduction Problem: Construct deterministic finite automata (DFA) for strings not containing consecutive two a's and starting with a. Explanation: Accept Strings that not contain consecutive two a's. Check if a given string contain consecutive two a's or not. The any occurrence of (b-z) should not affect the scenari
11 min read
Construct DFA with Σ = {0, 1} and Accept All String of Length at Least 2
Construct a DFA for a language accepting strings of length at least two, over input alphabets Σ = {0,1}. So that means in DFA, language consists of a string of length of at least 2 and can be greater than two. That means if DFA got the string of Length 0 or 1 then it will not accept it. A string of length zero means when the machine doesn't get any
5 min read
Construct DFA which interpreted as binary number is divisible by 2, 3, 4
Prerequisite: Finite Automata Introduction, Designing Finite Automata Problem-1: Construct DFA, which accepts set of all strings over {0, 1} which interpreted as a binary number is divisible by 2. Explanation: Consider the following inputs, {0, 01, 10, 11, 100, 101, 110........} The state transition diagram of the language will be like this: In thi
4 min read
Construct a DFA which accept the language L = {anbm | n > =1, (m) mod 3 = 1}
Problem: Construct a DFA which accept the language L = {anbm | n > =1, (m) mod 3 = 1}. Explanation: For constructing the DFA, the following things to be remember: [Tex](element)^*[/Tex] which means any no of elements, and [Tex](element)^+[/Tex] = [Tex](element).(element)^*[/Tex] which means any no of elements greater than 1. Examples: Input: a a
9 min read
DFA (Recognizer) for valid Pascal identifiers
Problem - Implement a recognizer for pascal identifiers based on a DFA that accepts strings belonging to the definition of the language of the same. Here is a regular definition for the set of Pascal identifiers that are defined as the set of strings of letters and digits beginning with a letter. letter : A | B | . . . | Z | a | b | . . . | z digit
6 min read
Program to build a DFA that accepts strings starting and ending with different character
Prerequisite: Deterministic Finite Automata Given a string, str consists of characters 'a' & 'b'. The task is to check whether string str starts and ends with different characters or not. If it does, print 'YES' with state transitions, else print 'NO'. Examples: Input: ababab Output: YES Explanation: The string "ababab" is starting with 'a' and
12 min read
Program to build a DFA to accept strings that start and end with same character
Given a string consisting of characters a and b, check if the string starts and ends with the same character or not. If it does, print 'Yes' else print 'No'.Examples: Input: str = "abbaaba" Output: Yes Explanation: The given input string starts and ends with same character 'a' So the states of the below DFA Machine will be q0->q1->q2->q2-
12 min read
DFA for exactly one of a and at least one of b
Deterministic Finite Automata (DFA) is defined as an abstract mathematical concept which is used to solve various specific problems in different software and hardware.In this type of problems we have some given parameters according to which we should design DFA. In this article,two instructions are given: DFA should have one of a DFA should have at
2 min read
Build a DFA to accept a binary string containing "01" i times and "1" 2j times
Given a binary string str, the task is to build a DFA that accepts given binary string if it contains "01" i times and "1" 2j times, i.e., [Tex]L={(01)^i (1)^{2j} \text{ where }i\geq1\text{ and }j\geq1} [/Tex] Examples: Input: str = "011111" Output: Accepted Explanation: The string follows the language as: (01)1(1)2*2 Input: str = "01111" Output: N
9 min read
DFA that recognizes number of 0 is multiple of 3 on input {0,1}
Finite Automata is known as a finite state machine that are acceptable otherwise not acceptable. on the input alphabet '0' and 1'. Determine the initial state.The transition occurs on every input alphabet.Determine whether the self-loop should apply or not.Mark's final state. Designing DFA step by step :Step-1: Make initial state “A” then it is the
5 min read
DFA that begins with 'a' but does not contain substring 'aab'
Prerequisite: Introduction to Deterministic Finite Automata Construct a DFA that accepts string str starting with input alphabet 'a' but does not contain 'aab' as a substring over input {a, b}. Examples: Input: str = "babba" Output: Not Accepted Explanation: The given string doesn't start with 'a'. Input: str = "abbaaaaa" Output: Accepted Explanati
10 min read
Design a DFA that accepts a string containing 3 a's and 3 b's
Problem Statement: Design a Definite Finite Automata for accepting the permutation of Three a's and Three b's over the input {a, b} Input: S = "aaabbb" Output: Accepted Explanation: The input has three a and three b. Input: S = "abababa" Output: Accepted Explanation: The input has three a and three b. To design a DFA we need to check the input char
15+ min read
Implementing DFA for no runs of length less than 4 for input (a,b)
DFA or Deterministic Finite Automata is a finite state machine, in which on every input alphabet a transition is done from one state to another state according to set of defined rules as per the need of string acceptance.In this particular problem, runs of length is the factor to think about.The input alphabets are {a, b}. No runs of length less th
15 min read
DFA of Regular Language L ={w ∈ {a,b}* : Na(w) mod 3 > Nb(w) mod 3}
In this article, we will design the Deterministic Finite Automata of the Regular Language L ={w ∈ {a, b}* : Na(w) mod 3 > Nb(w) mod 3}. Regular Expression can be anything from a terminal symbol, ∅, to union of two regular expressions (R1 + R2 ), their intersection (R1 + R2) or the regular expression’s closure (R1*) or a ∈ Σ, where Σ is the finite s
2 min read
Program to construct DFA accepting odd number of 0s and odd number of 1s
Given a binary string S, the task is to write a program for DFA Machine that accepts a string with odd numbers of 0s and 1s. Examples: Input: S = "010011"Output: AcceptedExplanation:The given string S contains odd number of zeros and ones. Input: S = "00000"Output: Not AcceptedExplanation:The given string S doesn't contains odd number of zeros and
7 min read
State Elimination Method convert DFA/NFA/Ɛ-NFA into Regular Expression
State Elimination Method : Rules to convert a DFA/NFA//Ɛ-NFA into corresponding Regular Expression. Arden's Method is not capable of converting Ɛ-NFA. By state elimination method you can conveniently and quickly find RE without writing anything just by imagination. Rule-1 : If there are no incoming edges to the start state proceed further to check
3 min read
Program to construct a DFA which accepts the language L = {aN | N ≥ 1}
Prerequisite: Finite Automata Given a string S of size N, the task is to design a Deterministic Finite Automata (DFA) for accepting the language L = {aN | N ? 1}. The regular language L is {a, aa, aaa, aaaaaaa..., }. If the given string follows the given language L, then print "Accepted". Otherwise, print "Not Accepted". Examples: Input: S = "aaabb
5 min read
Program to construct a DFA to check if a given integer is unsigned or not
Given a string S that represents an integer, the task is to check if the given string S represents an unsigned integer or not by constructing the DFA. If the given string represents an unsigned integer, then print "Unsigned integer". Otherwise, print "Not an unsigned integer". Examples: Input: S = "+4554"Output: Not an unsigned integer Input: S = "
10 min read