Found 345 Articles for Data Structure Algorithms

Construct ∈-NFA of Regular Language L = (0+1)*(00+ 11)

Bhanu Priya
Updated on 14-Jun-2021 15:24:11

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

C Program to construct a DFA which accepts L = {aN | N ≥ 1}

Bhanu Priya
Updated on 14-Jun-2021 15:19:30

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

Construct ∈-NFA of Regular Language L = 0(0+1)*1

Bhanu Priya
Updated on 14-Jun-2021 15:12:58

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

Explain the concept of grammar in TOC

Bhanu Priya
Updated on 01-Nov-2023 14:55:22

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

C Program to construct DFA for Regular Expression (a+aa*b)*

Bhanu Priya
Updated on 14-Jun-2021 14:58:10

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

How to convert left linear grammar to right linear grammar?

Bhanu Priya
Updated on 14-Jun-2021 14:55:02

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

How to convert right linear grammar to left linear grammar?

Bhanu Priya
Updated on 14-Jun-2021 14:51:40

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

Explain about left linear regular grammar in TOC

Bhanu Priya
Updated on 14-Jun-2021 14:49:30

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

Explain about right linear regular grammars in TOC

Bhanu Priya
Updated on 14-Jun-2021 14:46:58

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 non linear.Let’s discuss about right linear grammar ... Read More

What is Linear bounded automata in TOC?

Bhanu Priya
Updated on 14-Jun-2021 12:01:22

8K+ Views

A deterministic linear bounded automaton (LBA) is 9-tuple automataG = ( Q, Σ, E, δ, ε, q0, GL, GR, F)Where, Q is set of all statesΣ is set of all terminalsE input alphabet.δ is set of transitionsq0 initial stateGL left bound of tapeGR right bound of tape.F set of final stateA linear bounded automaton is called a multi-track non-deterministic Turing machine which has a tape of some bounded finite length.Length = function (Length of the initial input string, constant c)The computation in linear bounded automata is restricted to the constant bounded area. The input alphabet here contains two special symbols ... Read More

Advertisements