Found 282 Articles for Data Structure Algorithms

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

Explain the Decidable and undecidable problems

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

How to generate regular expression from finite automata?

Bhanu Priya
Updated on 16-Jun-2021 14:58:05

2K+ Views

There are two methods for converting deterministic finite automata (DFA) to Regular expression (RE). These are as follows −Arden’s MethodState Elimination MethodLet us understand these methods in detail.Arden’s TheoremLet P and Q be the two regular expressions.If P does not contain null string, then following equation in R, viz R = Q + RP,Which has a unique solution by R = QP*Here,The finite Automata do not have epsilon movesIt must have only initial state q1It’s states are q1, q2, q3,…….qn. The final state may be some qi where i

Explain the Star Height of Regular Expression and Regular Language

Bhanu Priya
Updated on 12-Jun-2021 11:58:55

557 Views

The star height of Regular expression (RE) is nothing but the depth of Kleene stars in the theory of computation (TOC).For example, a+b the star height is 0(a+b)* the star height is 1(a*+b*)* the star height is 2 …….Star height is used to indicate the structural complexity of regular languages and expressions.The regular expressions may have different star height that depends on structural complexity or nesting.The star height of a regular language is a unique number and that is equal to the least star height of any regular expression which represents that language.The star height of regular expressions is a ... Read More

How to convert FA to Left Linear Grammar in TOC?

Bhanu Priya
Updated on 12-Jun-2021 11:55:37

5K+ Views

A grammar with at most one variable at the right side of production is called linear grammar.Following is an example of the linear grammar −S→aSb/εHere, if you observe, we can write the same production by dividing …..S→AbA→aAbA→εLeft Linear GrammarA grammar is left linear grammar where all non-terminals in the right hand sides are at the left end.For example, A→Sa/εSteps for conversionThe steps for the conversion of finite automata (FA) to the left linear grammar are as follows −Step 1 − Take reverse of the finite automataStep 2 − write right linear grammarStep 3 − Then take reverse of the right ... Read More

How to convert FA to Right Linear Regular Grammar?

Bhanu Priya
Updated on 12-Jun-2021 11:53:24

7K+ Views

A grammar with at most one variable at the right side of production is called linear grammar.Example 1      S→aSb/εExample 2      S→Ab      A→aAb      A→εRight Linear GrammarA grammar is right linear grammar where all the non terminals in the right hand sides are at the right end.For example,       S->aS/εAlgorithm for conversionThe algorithm to convert the finite automata (FA) to the right linear grammar is as follows −Step 1 − Begin the process from the start state.Step 2 − Repeat the process for each state.Step 3 − Write the production as the ... Read More

Advertisements