- 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
Found 1259 Articles for Computers
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
2K+ Views
ProblemDesign a DFA for the language L={w1abaw2 | w1, w2 Є(a, b)*}, which means the DFA accepts all strings which contain “aba” as a substring.SolutionThe strings that are accepted by language L= {aba, aabaa, aabab, babab, ababa, …….}Step 1 − Transition diagram for minimal string (starting string) −If w1 and w2 are null then the string it generates is “aba” because w1, w2 ε(a, b)*q0 is the initial state and q3 is the final state.Step 2 − The final DFA for the given language is as follows −Explanationqo is the initial state q0 on ‘a’ goes to q1 and on ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
4K+ Views
The ε transitions in Non-deterministic finite automata (NFA) are used to move from one state to another without having any symbol from the input set Σ.ε-NFA is defined in 5 tuples representation{Q, q0, Σ, δ, F}Where, δ − Q × (Σ∪ε)→2QQ − Finite set of states∑ − Finite set of the input symbolq0 − Initial stateF − Final stateδ − Transition functionNFA without ε transitionNFA is defined in 5 tuples representation{Q, q0, Σ, δ, F}Where, δ − Q X Σ→ 2QQ − Finite set of states∑ − Finite set of the input symbolq0 − Initial stateF − Final stateδ − ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
15K+ Views
The ε transitions in Non-deterministic finite automata (NFA) are used to move from one state to another without having any symbol from input set Σε-NFA is defined in five tuple{Q, q0, Σ, δ, F}Where, δ − Q × (Σ∪ε)→2QQ − Finite set of statesΣ − Finite set of the input symbolq0 − Initial stateF − Final stateδ − Transition functionNFA without ε transitionNFA is defined in 5 tuple representation{Q, q0, Σ, δ, F}Where, δ − Q X Σ→ 2QQ − Finite set of statesΣ, − Finite set of the input symbolq0 − Initial stateF − Final stateδ − Transition functionNFA ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
589 Views
Let us take a string S of size N, we have to design a Deterministic Finite Automata (DFA) for accepting the language L = {aN | N ≥ 1}.The string accepting the language L is {a, aa, aaa, aaaaaaa…, }.Now the user has to enter a string, if that string is present in the given language, then print “entered string is Accepted”. Otherwise, print “entered string is not Accepted”.DFA transition diagram for the given language is −ExampleFollowing is the C program to construct DFA which accepts the language L = {aN | N ≥ 1} −#include int main() { char S[30]; ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
7K+ Views
The ∈ transitions in Non-deterministic finite automata (NFA) are used to move from one state to another without having any symbol from input set Σ∈-NFA is defined in five tuple representation{Q, q0, Σ, δ, F}Where, δ − Q × (Σ∪∈)->2QQ − Finite set of statesΣ − Finite set of the input symbolq0 − Initial stateF − Final stateδ: Transition functionNFA without ε transitionNFA also has five states same as DFA, but with different transition function, as shown follows −$$\delta\colon\:Q\times\:\sum\longrightarrow\:2^{Q}$$Where, Q − Finite set of statesΣ − Finite set of the input symbolq0 − Initial stateF − Final stateδ − Transition ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
39K+ Views
Grammar in theory of computation is a finite set of formal rules that are generating syntactically correct sentences.The formal definition of grammar is that it is defined as four tuples −G=(V, T, P, S)G is a grammar, which consists of a set of production rules. It is used to generate the strings of a language.T is the final set of terminal symbols. It is denoted by lower case letters.V is the final set of non-terminal symbols. It is denoted by capital letters.P is a set of production rules, which is used for replacing non-terminal symbols (on the left side of ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
11K+ Views
Design a Deterministic Finite Automata (DFA) for accepting the language L = (a+aa*b)* If the given string is accepted by DFA, then print “string is accepted”. Otherwise, print “string is rejected”.Example 1Input: Enter Input String aaaba Output: String Accepted.Explanation − The given string is of the form (a+aa*b)* as the first character is a and it is followed by a or ab.Example 2Input: Enter Input String baabaab Output: String not Accepted.The DFA for the given regular expression (a+aa*b) is −Explanation −If the first character is always a, then traverse the remaining string and check ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
8K+ Views
Regular grammar describes a regular language. It consists of four components, which are as follows −G = (N, E, P, S)Where, N: finite set of non-terminal symbols, E: a finite set of terminal symbols, P: a set of production rules, each of one is in the formsS → aBS → aS → ∈, S ∈ N is the start symbol.The above grammar can be of two forms −Right Linear Regular GrammarLeft Linear Regular GrammarNow, let us see the steps to convert left linear grammar to right linear grammar −Example 1Consider a left linear grammar as given below −S→ Sa|Abc A→ ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
4K+ Views
For every finite automata (FA) there exists a regular grammar and for every regular grammar there is a left linear and right linear regular grammar.Example 1Consider a regular grammar − a(a+b)* A → aB B → aB|bB|eFor the given regular expression, the above grammar is right linear grammar.Now, convert the above right linear grammar to left linear grammar.The rule to follow for conversion is, Finite Automata → Right linearThe reverse of right linear →left linear grammar.So, A → BaB → Ba|Bb|eFinally for every right linear there is aExampleConsider a language {bnabma| n>=2, m>=2}The right linear grammar for the given language ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
3K+ Views
Regular grammar describes a regular language. It consists of four components, which are as follows −G = (N, E, P, S)Where, N − finite set of non-terminal symbols, E − a finite set of terminal symbols, P − a set of production rules, each of one is in the formsS → aBS → aS → ∈, S ∈ N is the start symbol.The above grammar can be of two forms −Right Linear Regular GrammarLeft Linear Regular GrammarLinear GrammarWhen the right side of the Grammar part has only one terminal then it's linear else nonv linear.Left linear grammarIn a left-regular grammar ... Read More