- 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 345 Articles for Data Structure Algorithms
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
3K+ Views
The Post Correspondence Problem (PCP) was introduced by Emil Post in 1946 and is an undecidable decision problem.The PCP problem over an alphabet Σ is state. Given the following two lists, M and N of non-empty strings over Σ−M = (x1, x2, x3, ………, xn) N = (y1, y2, y3, ………, yn)We can say that there is a Post Correspondence Solution, if for some i1, i2, ………… ik, Where 1≤ ij ≤ n, the condition xi1 …….xik = yi1 …….yik satisfies.Example 1Find whether the lists M = (abb, aa, aaa) and N = (bba, aaa, aa) have a Post Correspondence ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
7K+ 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
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
5K+ 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
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
12K+ 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
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
964 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
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
9K+ Views
There are two types of languages in the theory of computation (TOC), which are as follows −DecidableUndecidableA problem is called decidable, when there is a solution to that problem and also can construct algorithms corresponding to that.Example of Decidable ProblemFind all the odd numbers in the range from 1 to 50.For this problem, we can easily find a solution by constructing an algorithm. In terms of Turing Machine (TM), if a problem is decidable, then the Turing machine halts whether or not it accepts its input.In terms of finite automata (FA), decidable refers to the problem of testing whether a ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
10K+ 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
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
24K+ Views
Usually, programs consist of loops that are limited or unlimited in length.The total work done by the program completely depends on the input given to the program.The program may consist of several different numbers of loops that may be in linear or nested manner.The Halting Problem is the problem of deciding or concluding based on a given arbitrary computer program and its input, whether that program will stop executing or run-in an infinite loop for the given input.The Halting Problem tells that it is not easy to write a computer program that executes in the limited time that is capable ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
9K+ Views
A Turing machine is a seven tuples(Q, Σ, Γ, δ, q0, qacc, qrej)Where, Q is a finite set of states;Σ is the input alphabet does not contain the blank symbol t;Γ is the tape alphabet, where t ∈ Γ and Σ ⊆ Γ;δ: (Q × Γ) → (Q × Γ × {L, R}) is the transition function;q0 ∈ Q is the start state;qacc ∈ Q is the accept state;qrej ∈ Q is the reject state, where qrej ≠ qacc.ProblemConstruct Turing machine (TM) for multiplication of two unary integers.SolutionMultiplication of two unary integers 3*2=6 In Turing Machine 3 represents − 111 ... Read More
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
1K+ 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