Computer Science
NP Complete
NP Complete is a class of computational problems that are considered to be among the most difficult to solve. These problems are in the category of NP (nondeterministic polynomial time) problems, which means that they can be verified in polynomial time but not necessarily solved in polynomial time. The difficulty of NP Complete problems has important implications for cryptography, optimization, and other areas of computer science.
Written by Perlego with AI-assistance
Related key terms
1 of 5
10 Key excerpts on "NP Complete"
- eBook - ePub
Automata and Computability
A Programmer's Perspective
- Ganesh Gopalakrishnan(Author)
- 2019(Publication Date)
- Chapman and Hall/CRC(Publisher)
16 NP-Completeness16.1 What Does NP-Complete Mean?Chapter Gist: There are many important practical problems for which no polynomial time (P) algorithms are known. These problems can, so far, only be solved in nondeterministic polynomial time (NP), and currently this amounts to being intractable (exponential or worse). We define NP to be the class of polynomial time verifiable problems, and NP-Complete to be the hardest of all NP problems (§16.1). We present the role of NDTMs in formulating the theory of NP-Completeness in precise terms (§16.2). We take up the study of the Boolean satisfiability problem (SAT) given it has the distinction of being the first NP-Complete (NPC) problem identified (§16.3). We explain why SAT matters in practice, and also introduce a SAT-solver that can run within your own web browser (§16.8). We begin with the simpler 2-SATpolynomial time algorithm (§16.3.1). We describe a canonical problem called 3-SAT, and describe its role in showing new problems to be NP-Complete (§16.4). The idea of mapping reductions is central to this study, and we show that 3-SAT itself can be shown to be NP-Complete (§16.5). We show that the problem of finding k-cliques in a graph is NP-Hard by presenting a mapping reduction from 3-SAT to it (§16.6). We finish with some caveats and also a discussion of CoNP and allied complexity classes (§16.7).In the 1960s, computer scientists started noticing that many problems defy polynomial time algorithms; all they could come up with were exponential (or worse) algorithms. Examples of these problems included everyday scheduling problems such as the Traveling Salesperson Problem (TSP), one version of which is the following. Suppose you are asked to start from Salt Lake City, UT, travel by road and visit all the 48 US state capitals of the contiguous USA exactly once and return to Salt Lake City in 18 days or less.1 What is the optimal route you would take?2 Is there a better algorithm than computing the cost of all 48! such tours and picking the one that finishes in 18 days or less? All algorithms so far have been intractable (exponential or worse; - Lekh Raj Vermani, Shalini Vermani(Authors)
- 2019(Publication Date)
- WSPC (EUROPE)(Publisher)
Chapter 15NP-Complete Problems
Most of the algorithms we have studied so far were polynomial-time algorithms, i.e., algorithms having time complexity O(nk) where n is the size of the input instance and k is a constant positive integer. However, not all problems can be solved in polynomial time — there do indeed exist such problems as cannot be solved in polynomial time. Problems that are solvable by polynomial-time algorithms are called easy or tractable. Those problems that cannot be solved by polynomial-time algorithms are called hard or intractable.There do exist several problems which are not solvable by polynomial-time algorithms. For example, the Traveling Salesman Problem involving n cities to be visited is one such. There is no algorithm which solves this problem in general and the only way to solve it is by brute force. There are (n − 1)! possible tours, we need to find the cost for each tour and then to look for a tour with minimum cost. Therefore solving this problem by brute force requires (n − 1)! computations. Observe that (n − 1)! > 2nfor all n ≥ 6 and, so, the time complexity for such a solution is even more that exponential.In general, there are three types of problems — P, NP and NP-complete. There is another class of problems, i.e., Co-NP but we do not consider these here (although we may define this class). Every problem in class P is in class NP but “is every problem in class NP in class P” is still an interesting open problem. Problems in the class NP-complete are in the class NP and are the most difficult ones in the class NP. The problems in the class NP-complete have an interesting property that if one of these is solvable in polynomial time, then every other problem in the class is solvable in polynomial time (cf. [5]).Most problems that have been considered so far in the earlier chapters are in P. In this chapter, our effort is to study and identify NP-complete- eBook - PDF
A Textbook of Data Structures and Algorithms, Volume 3
Mastering Advanced Data Structures and Algorithm Design Strategies
- G. A. Vijayalakshmi Pai(Author)
- 2022(Publication Date)
- Wiley-ISTE(Publisher)
Thus, the satisfiability problem, which has exponential time complexity over a deterministic machine, reports polynomial time complexity on a nondeterministic machine. Therefore, the satisfiability problem belongs to the NP class. 22.4. NP-complete and NP-hard problems The NP class was introduced as a class of problems to which the best-known algorithms to date report exponential time complexity. Also, these problems do not show evidence that polynomial time algorithms do not exist for them either. However, the best thing is that many of the problems for which no polynomial time algorithm exists, seem to be computationally related establishing two classes of problems, for example, NP-complete and NP-hard. 298 A Textbook of Data Structures and Algorithms 3 Figure 22.1. Nondeterministic algorithm for the satisfiability problem An NP-complete problem is one that can be solved in polynomial time if all other NP-complete problems can also be solved in polynomial time. An NP-hard problem is one which, if solvable in polynomial time, then all other NP-complete problems can be solved in polynomial time. Thus, all NP-complete problems are NP-hard but all NP-hard problems are not NP-complete. The formal definitions that describe NP-completeness are listed in the next section. 22.4.1. Definitions 22.4.1.1. Problem reducibility Let X and Y be two problems. X reduces to Y, denoted as X ∝ Y if there is a method to solve X by a deterministic polynomial time algorithm using a deterministic algorithm that solves Y in polynomial time. It can be proved that problem reducibility satisfies the transitivity property. Thus, if X ∝ Y and Y ∝ Z then X ∝ Z. 22.4.1.2. NP-hard problem The problem X is NP-hard if the satisfiability problem reduces to X, that is, SAT ∝ X. 22.4.1.3. NP-complete problem A problem X is NP-complete if X is NP-hard and X ∈ 𝑁𝑃. - eBook - PDF
Limits of Computation
An Introduction to the Undecidable and the Intractable
- Edna E. Reiter, Clayton Matthew Johnson(Authors)
- 2012(Publication Date)
- Chapman and Hall/CRC(Publisher)
But why are NP -hard problems not easy? Why call them intractable? This brings us to the boundaries of computer science knowledge. There is no known polynomial algorithm for any NP -hard problem. However, it has never been shown—and will (almost certainly) never be shown that NP -hard problems do not have polynomial solutions. The famous incompleteness theorem of Kurt Godel shows that any theory will have some statements that are true but can never be proved, and (most) computer scientists think that the nonexistence of polynomial solutions for NP -hard problems is in this category. In other words, it is believed that no one will find a polynomial time algo-rithm for any NP -hard problem. It is also believed that no one will prove that a polynomial time algorithm does not exist. The person who can do either one of these—find a polynomial algorithm for some NP -hard prob-lem or show that one cannot exist—will be immediately famous, at least in the world of theoretical computer science. See the Web site referenced in Exercise 11 at Claymath.org for a temptation to take on this problem. If either of these is achieved, the whole theory of complexity will essen-tially collapse, and the phrases NP -hard and NP -complete never again be mentioned in any computer science class, except perhaps in passing refer-ence to the ignorance of the ancients. Classes NP and NP -Complete ◾ 171 To reiterate the important points: (1) no NP -hard problem has a known polynomial algorithm, but (2) we cannot show that no polynomial algo-rithm exists. 8.7 A FIRST NP -COMPLETE PROBLEM: BOOLEAN SATISFIABILITY So far, we have defined NP -complete and NP -hard, but have given no examples. The first example, and the proof that the problem is in these two classes, is basic to all further discussion. - eBook - PDF
What Can Be Computed?
A Practical Guide to the Theory of Computation
- John MacCormick(Author)
- 2018(Publication Date)
- Princeton University Press(Publisher)
Reformulations of P versus NP using NP-completeness So, now we know that NP-complete problems like SAT are the “hardest” problems in NP. This fact has some remarkable consequences. For example, if someone invented a polynomial-time algorithm for SAT, it would immediately yield polynomial-time algorithms for every other problem in NP. (Why? Because all those other problems are “no harder than” SAT. More formally, the other problems D all polyreduce to SAT, so we can transform an instance of D to an instance of SAT in polynomial time, and then solve the SAT instance in polynomial time.) This gives us yet another way of asking whether P equals NP: P VERSUS NP (version 5) Is SAT in P ? And finally, there’s nothing special about SAT in version 5 of P versus NP above. We know that all the NP-complete problems are polyequivalent, so P versus NP can be reformulated yet again as P VERSUS NP (version 6) Is any NP-complete problem in P ? 14.3 NP-HARDNESS Informally, a problem is NP-hard if it is at least as hard as the NP-complete problems. Formally, we define it as follows: Definition of NP-hard. A computational problem F is NP-hard if there exists some NP-complete problem C with C ≤ P F. Another way of thinking about this is that “NP-hard” and “NP-complete” mean the same thing, except that NP-complete problems must be in NP, whereas NP-hard problems may be outside NP. Definitions 1–3 of NP-completeness 14.3 NP-hardness • 299 (starting on page 297) all work for NP-hardness if we remove the requirement of membership in NP. Note in particular that NP-hard problems do not have to be decision problems, whereas NP-complete problems must be decision problems. We also define the complexity class NPHard as the set of all NP-hard problems. Obviously, NPComplete ⊆ NPHard. But the converse does not hold: it’s easy to come up with problems that are NP-hard but not NP-complete. This is because all NP-complete problems are, by definition, decision problems. - eBook - PDF
Mathematics and Computation
A Theory Revolutionizing Technology and Science
- Avi Wigderson(Author)
- 2019(Publication Date)
- Princeton University Press(Publisher)
Now we are ready for a definition of NP , the class of problems generalizing these two examples. The class NP contains all properties C for which membership (namely, state-ments of the form x ∈ C ) have short, efficiently verifiable proofs. As before, we 8 In the computer science literature, C is often called a language . 26 COMPLEXITY 101, P AND NP use polynomials to define both terms. A candidate proof y for the claim x ∈ C must have length at most polynomial in the length of x . And the verification that a given y indeed proves the claim x ∈ C must be checkable in polynomial time (via a verification algorithm we will call V C ). Finally, if x 6 ∈ C , no such y should exist. Let us formalize this definition. Definition 3.3 (The class NP ) . The set C is in the class NP if there is a function V C ∈ P and a constant k such that • If x ∈ C , then ∃ y with | y | ≤ k · | x | k and V C ( x, y ) = 1; • If x 6 ∈ C , then ∀ y we have V C ( x, y ) = 0. From a logic standpoint, each set C in NP may be viewed as a set of theorems in the complete and sound proof system defined by the verification process V C . A sequence y that “convinces” V C that x ∈ C is often called a witness or cer-tificate for the membership of x in C . Again, we stress that the definition of NP is not concerned with how difficult it is to come up with a witness y , but rather only with the efficient verification using y that x ∈ C . The witness y (if it exists) can be viewed as given by an omnipotent entity, or simply guessed. Indeed, the acronym NP stands for “Nondeterministic Polynomial time,” where the nondeter-minism captures the ability of a hypothetical nondeterministic machine to “guess” a witness y (if one exists) and then verify it deterministically. Nonetheless, the complexity of finding a witness is, of course, important, as it captures the search problem associated with NP sets. - William Cruz-Santos, Guillermo Morales-Luna(Authors)
- 2022(Publication Date)
- Springer(Publisher)
CHAPTER 2 Approximability of NP-hard Proble01s The purpose of this chapter is to give a succinct introduction to computational complexity and its principal problems, the scope which ranges from complexity classes to approximating optimiza- tion problems. Background knowledge of Turing machines (TM) is assumed (see [7, 9, 42]). Here, we emphasize the relationship between decision and optimization problems. In order to do this, we recall the class P in terms of Deterministic Turing Machines (DTM) and the class NP, in terms of DTMs that test membership in languages. The class NP has a probabilistic characterization in terms of Probabilistic Turing Machines (PTM), captured in the PCP theorem. The PCP theorem has important applications in approx- imating solutions to NP-hard problems using a standard methodology. We also introduce the randomized complexity classes and their connections with optimiza- tion problems. Randomized computation is related to quantum computation by its probabilistic nature; that is, the quantum complexity class BQP contains the classical complexity class BPP. In what follows, we make a survey of these notions. 2.1 BASIC DEFINITIONS Let L be a language. There exists a DTM M that recognizes L whenever L is decidable. Given a DTM M, let LM be the language recognized by M. M is said to be polynomial-time, if for each input string x, with lxl = n, M performs at most O(nk) computing steps for a fixed non-negative exponent k, where lxl denote the length of the string x. Definition 2.1 The class P consists of all languages recognized by polynomial time DTMs . Let L be a language. A verification procedure for L is a DTM V that satisfies the following conditions. l. Completeness: For each x EL there exists a stringy such that V(x, y) = 1. (V accepts y as a valid proof for the membership of x in L) 2. Soundness: For each x ¢.Land every stringy it holds that V(x, y) = 0. (V rejects y as proof for the membership of x in L) 5- eBook - PDF
Design and Analysis of Algorithms
A Contemporary Perspective
- Sandeep Sen, Amit Kumar(Authors)
- 2019(Publication Date)
- Cambridge University Press(Publisher)
12 C H A P T E R NP Completeness and Approximation Algorithms In the previous chapters we surveyed many well-known algorithmic techniques and successfully applied them to obtain efficient algorithmic solutions for problems from varied domains. Yet, we cannot claim that there is some general methodology for obtaining efficient algorithms for any given problem. To the contrary any new problem often presents unknown challenges that require new insights and the question that is uppermost in anyone’s mind is - what are the problems that are notoriously difficult? We need to first set some target before we can assign a notion of difficulty to a problem. For reasons that will become clear later on, the quest is to design a polynomial time algorithm for any given well-defined problem. This may appear too liberal initially since by definition even n 100 is a polynomial. However, even this has proved elusive for a large number of problems among which we have come across one in the preceding chapters, namely, 0-1 Knapsack problem. Despite promising starts, we could never claim a truly polynomial time algorithm. In addition to fixing the limits of practical computation being a polynomial time algorithm, we need to specify the underlying computational model since that will also affect what is achievable in polynomial time. Fortunately, the notion of polynomial time is a robust concept that is not significantly affected by the choice of computational model, except for some constant factors in the exponent of n. We will discuss about a large class of natural and important problems that admits a characterization, that is very intuitive NP Completeness and Approximation Algorithms 231 and has resulted in a very interesting theoretical framework. Since the reader is familiar with the Knapsack problem, we will illustrate this framework in the context of the Knapsack problem. Consider a Prover , Verifier interactive game regarding any given Knapsack instance. - eBook - PDF
Algorithms: Design Techniques And Analysis
Design Techniques and Analysis
- M H Alsuwaiyel(Author)
- 1999(Publication Date)
- World Scientific(Publisher)
A problem II is P-complete if it is in P and all problems Definition 11.14 The class NC consists of those problems that can be solved in polylogarithmic time, that is O(logk n) time, using a polynomial number of processors. This class remains invariant under different models of parallel computa- tion. It encompasses those problems that are well-parallelizable in the sense that increasing the number of processors results in significant speedup. Ob- serve that NC C P, as the total number of steps performed by a parallel algorithm is the product of the running time and the number of processors, 322 Introduction to Computational Complexity which is polynomial in the case of NC algorithms. In other words, such a parallel algorithm can be transformed into a polynomial time sequential algorithm. Interestingly, if a problem is P-complete, then every other problem in P can be reduced to it in polylogarithmic time using a polynomial number of processors. This type of transformation is called NC-reduction. It can be shown that NC is closed under NC-reduction. This motivates the next alternative definition of P-complete problems. However, there is a general belief that NC # P. Definition 11.15 in P can be reduced to II using NC-reduction. A problem Il is P-complete if it is in P and all problems This definition yields the following theorem: Theorem 11.13 If a problem II is P-complete and II is in NC, then P = NC. In other words, if P # NC, then all P-complete problems must be- long to P - NC. Thus, although P-complete problems are not likely to be solvable in logarithmic space, they also do not seem to admit efficient parallel algorithms. The following problem is the first problem identified as P-complete. - eBook - PDF
- R. Gary Parker, Ronald L. Rardin(Authors)
- 2014(Publication Date)
- Academic Press(Publisher)
Problems to which all members of NP polynomially reduce are called NP-Hard. Although none is even close to being solved polynomially, it has turned out that the family of AT-Hard problems is amazingly rich. It includes, in particular, virtually all the problems that have frustrated dis-crete optimizers for decades. A very partial list would include traveling salesman, graph-coloring, precedence constrained scheduling, parallel-pro-cessor scheduling, knapsack, set covering/packing/partitioning, various fixed charge models, and 0 — 1 integer/mixed-integer programming. 2.3 NP-Equivalent Problems 29 The key to the discovery of so many NP-Hard problems, and indeed the seminal development of all recent complexity theory was achieved by Stephen Cook (1971). Cook showed that a particular problem in logic, known as the Satisfiability Problem, was NP-Hard. This result started the wheel in motion, and Richard Karp's (1972) work provided real momen-tum by demonstrating the reducibility of satisfiability to various well-known problems in the discrete optimization literature. As suggested, the satisfiability problem is one that is perhaps more nearly suited for the domain of the logician than say the operation researcher. Define a set of Boolean variables {x x ,x 2 , · . · , x n ) and let the comple-ment of any of these variables x t be denoted by jc,·. In the language of logic, these variables are referred to as literals. To each literal we assign a label of true ox false such that x t is true if and only if x t {{false. Using standard notation where the symbol V denotes or and is the symbol for and, we can write any Boolean expression in what is referred to as conjunctive normal form, i.e., as a finite conjunction of disjunctions using each literal once at most.
Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.









