Left Linear Regular Grammar in Theory of Computation

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

Right Linear Regular Grammars in Theory of Computation

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 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 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 Theory of Computation

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

Significance of NP-Complete Problems

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

Decidable and Undecidable Problems Explained

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

12K+ Views

Before we understand about the decidable and undecidable problems in the theory of computation (TOC), we must learn about the decidable and undecidable language. Hence, let us first see what do you mean by decidable language.Decidable LanguageA language L is called decidable if there is a decider M such that L( M) = L.Given a decider M, you can learn whether or not a string w ∈ L(M).Run M on w.Although it might take a long time, M will accept or reject w.The set R is the set of all decidable languages.L ∈ R if L is decidable.Undecidable LanguageA decision ... Read More

Convert CFG to CNF

Bhanu Priya
Updated on 12-Jun-2021 12:34:50

4K+ Views

CFG stands for context free grammar and CNF stands for Chomsky’s Normal Form in the theory of computation.Context Free Grammar (CFG)A context free grammar (CFG) is a forma grammar which is used to generate all possible patterns of strings in a given formal language.It is defined as four tuples −G=(V, T, P, S)Where, 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 ... Read More

Regular Expressions to Finite Automata

Bhanu Priya
Updated on 12-Jun-2021 12:29:13

985 Views

For each of the following languages, draw the finite automata (FA) accepting it.{a, b}*{a}The language states that the automata accept the strings containing any number of a's and b's and finally ending in a.The finite state automaton for the language is as follows −{a, b}*{b, aa}{a, b*}The language states that the automata accept the strings starting and ending with any number of a's and b's and containing any of the substrings b and aa.The finite state automaton for the language is a follows −{bbb, baa}*{a}The language states that the automata accept the strings containing any number of bbb's and baa's ... Read More

Eliminate Epsilon, Unit and Useless Symbols and Rewrite into CNF

Bhanu Priya
Updated on 12-Jun-2021 12:15:02

1K+ Views

ProblemEliminate epsilon, unit and the useless symbols for the given grammar and rewrite it into CNF.S->0E0|1FF| εE->GF->S|EG->S| εSolutionIn the given grammar, we will first remove the null production. There are two null productions in the grammar, as given below −S ==> εG ==> εSo, remove null production and rewrite all the other rules containing G by epsilon there, along with old productions. We do not remove S ==> epsilon as it is the start symbol.Remove G ==> epsilon, we get the following −S ==> 0E0 | 1FF | εE ==> G | εF ==> S | EG ==> SNow remove ... Read More

Advertisements