Found 1163 Articles for Computers

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

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

9K+ 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

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

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

15K+ 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

12K+ 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

7K+ 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

5K+ 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

4K+ 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

Prove that the vertex cover is NP complete in TOC

Bhanu Priya
Updated on 14-Jun-2021 11:57:20

9K+ Views

It is the subset(minimum size) of vertices of a graph G such that every edge in G incident to at least one vertex in G.Vertex Cover (VC) ProblemTo prove VC is NP-complete we have to prove the following −VC is Non-deterministic Polynomial (NP).A NPC problem can be reduced into VC.To prove VC is NP, find a verifier which is a subset of vertices which is VC and that can be verified in polynomial time. For a graph of n vertices it can be proved in O(n2). Thus, VC is NP.Now consider the “clique” problem which is NPC and reduce it ... Read More

Prove that the Hamiltonian Path is NP-Complete in TOC

Bhanu Priya
Updated on 14-Jun-2021 11:55:07

6K+ Views

A Hamilton cycle is a round trip path along n edges of graph G which visits every vertex once and returns to its starting vertexExampleGiven below is an example of the Hamilton cycle path −Hamilton cycle path: 1, 2, 8, 7, 6, 5, 4, 3, 1TSP is NP-CompleteThe travelling salesman problem (TSP) is having a salesman and a set of cities. The salesman needs to visit each one of the cities starting from a certain one and returning to the same city i.e. back to starting position. The challenge of this problem is that the travelling salesman wants to minimise ... Read More

What is NP-completeness in TOC?

Bhanu Priya
Updated on 14-Jun-2021 11:52:48

15K+ Views

The Non-deterministic Polynomial (NP) problems were a little harder to understand. In terms of solving a NP problem, the run-time is not polynomial. It would be something like O(n!) or something larger.However, this class of problems are given a specific solution, and checking the solution would have a polynomial run-time.For example, the Sudoku game.NP-Hard ProblemsA problem is said to be NP-Hard when an algorithm for solving NP Hard can be translated to solve any NP problem. Then we can say, this problem is at least as hard as any NP problem, but it could be much harder or more complex.NP-Complete ... Read More

Why the NP-complete problems are significant?

Bhanu Priya
Updated on 14-Jun-2021 11:51:02

1K+ Views

The Non-deterministic Polynomial (NP) problems were a little harder to understand. In terms of solving a NP problem, the run-time cannot be polynomial. It would be something like O(n!) or something larger.However, this class of problems are given a specific solution, and checking the solution would have a polynomial run-time.For example, the Sudoku game.NP-Hard ProblemsA problem is said to be NP-Hard, when an algorithm for solving the NP Hard can be translated to solve any NP problem. Then we can say, this problem is at least as hard as any NP problem, but it could be much harder or more ... Read More

Advertisements