1.1 P, NP, and NP-complete

Size: px
Start display at page:

Download "1.1 P, NP, and NP-complete"

Transcription

1 CSC5160: Combinatorial Optimization and Approximation Algorithms Topic: Introduction to NP-complete Problems Date: 11/01/2008 Lecturer: Lap Chi Lau Scribe: Jerry Jilin Le This lecture gives a general introduction of P, NP and NP-complete problems. We will study the definition and some classic examples of NP-complete problems (e.g. SAT, 3-SAT, Vertex Cover). More importantly, we will learn how to show that a problem is not easier than another problem by polynomial-time reduction. Polynomial-time reduction is the general method to prove that a new problem is NP-complete, so that we have an excuse not to find the optimal solution...as we encounter more NP-complete problems, we will learn some general techniques for reductions (e.g. restriction, local replacement and component design ). For each optimization problem, there is a corresponding decision problem. In this lecture, we focus on decision problems. 1.1 P, NP, and NP-complete Somehow we believe that an efficient algorithm should run in polynomial time, i.e., O(n c ) for input size n and some constant c. Consequently, problems that can be solved in polynomial time are treated as easy problems (although c can be arbitrarily large...), and we use P to denote the set of polynomial-time-solvable problems. Here is the formal definition: P: the set of problems that can be solved in polynomial time. Example: Some problems in P: Shortest Path Problem: in a graph, find a path between two vertices such that the sum of the weights of its constituent edges is minimized. Is-Prime Problem: whether an input number is prime. This problem was shown in P in Decision version of linear programming. Some problems that we can not solve in polynomial time so far: Factorization: given n and k, determine whether n has any prime factors less than k. Polynomial Identities Testing: determining whether a given multivariate polynomial is identically equal to 0. Graph Coloring: given k, determine whether a graph has a k vertex (or edge) coloring. 1 Manindra Agrawal, Neeraj Kayal, Nitin Saxena, PRIMES is in P, Annals of Mathematics 160 (2004), no. 2, pp. 781C793. 1

2 The problems that can not be solved in polynomial time so far 2 are considered as hard problems. For the hard problems, if (say by guessing or a magical box) we are given a solution for a problem, we may be able to check whether the solution is correct very efficiently (i.e. in polynomial time). This leads to the definition of NP problems: NP: the set of problems for which the Yes answer (with a certificate, e.g. a solution) can be verified in polynomial time. NP stands for Non-deterministic Polynomial time. One quick observation is that any problem in P is also in NP, because we can verify its answer by solving the problem (and so do not even need a certificate). On the other hand, many hard problems mentioned above are also in NP: although we don t have a polynomial-time algorithm for it, we can verify a solution in polynomial time. To understand the relation between P and NP, it is useful to have a hardest problem in NP. Here comes the definition for NP-completeness: A problem is NP-complete if: 1. It is in NP; and 2. If it can be solved in polynomial time, then any problem in NP can be solved in polynomial time. Generally NP-complete (NPc for short in the following) problems are considered as the hard problems. The interesting thing is that we never say NPc problems can not be solved in polynomial time in the formal definition, because we do not have a proof for it. Instead, we use the second property in the definition to link all the NPc problems together: any NPc problem is at least not easier than any other NPc problem. The technique to show that a problem A is not easier than another problem B is Polynomial-time Reduction, which will be shown in next section. Based on the above description (and our belief), the relation of P, NP and NPc problems are shown in Figure Note that we do not know for sure whether NP or NPc problems are polynomialtime-solvable. This is the most famous open problem in theoretical computer science, and the Clay Mathematics Institute offers a million dollar for its solution. Figure 1.1.1: What we think the world looks like... 2 and we almost believe they can never be solved in polynomial time... 2

3 1.2 Polynomial Time Reduction Polynomial time reduction is the technique to show that a problem R is not easier than another problem Q 3. The general procedure of polynomially reducing Q to R is shown in Figure Polynomially reducing Q to R (Q P R) 1. Given an instance q of problem Q. 2. Find a polynomial-time transformation f which maps q to an instance f(q) of problem R. 3. q and f(q) have the same answer. Figure 1.2.2: Polynomial-time reduction from problem Q to problem R Example: Reduction between Clique and Independent Set The Clique Problem is to determine whether a graph has a complete subgraph of size k (i.e. with k vertices); while the Independent Set Problem is to determine whether a graph has an independent set 4 with k vertices. Consider the example in Figure where we show a graph G and its complement graph 5. It is easy to see that each clique in G becomes an independent set in the complement graph. This leads to the easy reduction from Clique Problem to Independent Set Problem: 1. We are given an instance of Clique Problem: given a graph G and an integer k, determine whether it has a clique of size k. 2. In polynomial time, we construct G which is the complement graph of G. Now the instance of Independent Set Problem is to determine whether G has an independent set of size k. 3. Obviously G has a clique of size k if and only if G has an independent set of size k. Following similar steps, we can also reduce Independent Set Problem to Clique Problem. Based on the above discussion the following theorem holds: Theorem The Clique Problem can be reduced to the Independent Set Problem, and vice versa. We say these two problems are polynomially equivalent. 3 In other words, if we can solve R in polynomial time, then we can also solve Q in polynomial time. 4 An independent set is a set of vertices such that there is no edge between any pair of vertices. 5 In the complement graph of G, there is an edge between two vertices if and only if there is NO edge between these two vertices in the original graph G. 3

4 Figure 1.2.3: Clique and independent set Example: Reduction between Partition and Subset-Sum Now we consider another pair of problems: Partition Problem: given a set X and size s(x) for each x X, determine whether there is a subset X in X such that s(x) = x X x X/X s(x) Subset-Sum Problem: given a set X and size s(x) for each x X, and an integer B, determine whether is a subset X in X such that x X s(x) = B The reduction from Partition to Subset-Sum is trivial: Partition is just a special case of Subset-Sum where B = x X s(x)/2. However, we will show that Partition itself is also not easier than the more general Subset-Sum. This requires a little trick, and we will summarize all such tricks later on. Reduce Subset-Sum to Partition: 1. We have an instance of Subset-Sum: A set X which is a sequence of numbers x 1,x 2,...,x n and a target B. 2. We add two new elements into the set, now the set becomes x 1,x 2,...,x n, x i + B,2 x i B. We use the new set as the input of the instance of Partition: given the new set, determine whether there is a partition that equally divides it into two sets. 3. We show that the original instance of Subset-Sum and the corresponding instance of Partition has the same answer. First, if there is a partition, the two new elements can not be in the same subset because they add up to 3 x i which is larger than half of total sum. Let s say there is a partition which divides the set into two subsets: M { x i + B} and W {2 x i B} (M and W are two subsets of the input set). We know that the sum of each of the subsets is 2 x i, then the sum of all the elements in W must be equal to B, hence we find a solution for the original instance of Subset-Sum. On the other hand, if there is no 4

5 partition that can equally divide the set, then there is no subset W which can adds up to B. Therefore, we have yes for the constructed instance of Clique if and only if we have yes for the original instance of Subset-Sum. Based on the above discussion, the following theorem holds: Theorem The Partition Problem can be reduced to the Subset-Sum Problem, and vice versa Example: Reduction between Hamiltonian Cycle and Hamiltonian Path Hamiltonian Cycle Problem: given a graph G, determine whether there is a cycle which visits every vertex exactly once. Subset-Sum Problem: given a graph G, determine whether there is a (non-cycle) path which visits every vertex exactly once Reduce Hamiltonian Path to Hamiltonian Cycle We have seen some examples of polynomial-time reduction, the essential part is the transformation of the inputs such that the original instance and the constructed instance of problems have the same answer. For this specific reduction, the task is to construct a new graph. Let graph G be the input of the Hamiltonian Path Problem, we construct a graph G by adding one more vertex v to G and adding an edge between v and any vertex in G. The transformation is shown in Figure Figure 1.2.4: Reduction from hamiltonian path to hamiltonian cycle. If graph G has a Hamiltonian Cycle, and let s say the cycle uses the edge a v and v b as shown in Figure 1.2.4, then removing these two edges from the cycle, the remaining part in the cycle becomes a Hamiltonian Path in the original graph G. On the other hand, if graph G has a Hamiltonian Path, and let s say the path starts at vertex a and ends at vertex c, then by adding edge v a and c v to the path, it becomes a Hamiltonian Cycle for the graph G. Therefore, we proved that G has a Hamiltonian Cycle if and only if G has a Hamiltonian Path. This shows the reducibility from Hamiltonian Path Problem to Hamiltonian Cycle Problem. 5

6 Reduce Hamiltonian Cycle to Hamiltonian Path As usual the other direction is a little more complicated. We will still do some tricks on the original graph G and the transformation is shown in Figure In graph G, let s say a is a vertex and it is adjacent to vertices b,c and d. In graph G, we add three new vertices, v 1, v 2 and v. Vertex v 1 is adjacent to a, vertex v has an edge to all of vertex a s neighbors in graph G (in this case b,c,d), and vertex v 2 is adjacent to v. Figure 1.2.5: Reduction from hamiltonian cycle to hamiltonian path. If graph G has a Hamiltonian Path, then its end points must be v 1 and v 2. Without loss of generality, let s say edge v d is chosen in the Hamiltonian Path, then by removing vertex v 1,v 2,v and all of their incident edges from the path, and adding an edge a d (this edge always exists by our construction), we have a Hamiltonian Cycle for the original graph G. On the other hand, if graph G has a Hamiltonian Cycle, and let s say edge a c is chosen in the cycle, then by removing edge a c, and adding edge v 1 a, c v, v v 2, we have a Hamiltonian Path for the constructed graph G. Therefore, we prove that G has a Hamiltonian Path if and only if G has a Hamiltonian Cycle. This shows the reducibility from Hamiltonian Cycle Problem to Hamiltonian Path Problem. Based on the above discussion, the following theorem holds: Theorem The Hamiltonian Path Problem can be reduced to the Hamiltonian Cycle Problem, and vice versa. 1.3 Techniques for Proving NP-completeness Based on the definition of NP-completeness in Section 1.1, and the discussion of polynomial-time reduction in Section 1.2, the general way to show NP-completeness of a new problem Q is: 1. Show that Q is in NP, i.e., a solution of Q can be verified in polynomial time; and 2. Reduce a known NPc problem to Q, i.e., show that Q is the hardest problem in NP. 6

7 1.3.1 SAT and Cook s Theorem Let s first introduce the SAT (Satisfiability) problem. Define x i (i = 1,...,n) to be a set of boolean variables. For each variable, x i and x i are called literals. If we OR together a set of literals, we get a clause, e.g., (x 1 x 2 x 4 x 7 ). We consider a formula which is a conjunction (AND) of all the clauses and wants to determine whether such a formula is satisfiable (i.e., whether there is a value assignment of the variables such that the formula is equal to truth). In later of this section we will show some classic NPc problems, and SAT is treated as the base problem because of the following famous theorem: Theorem (Cook s Theorem) SAT is NP-complete. In other words, if SAT can be solved in polynomial time, then any NP problem can be solved in polynomial time. Cook s Theorem gives us a starting point for showing NP-completeness. Figure shows a family tree of some classic NPc problems. Note that this is not the only way to draw the tree, e.g., some people may make Clique as the father of Vertex Cover because of different reduction methods. Figure 1.3.6: A family tree of the NPc problems Circuit-SAT We can add a father to SAT in Figure 1.3.6, which is called Circuit-SAT. The formal definition is as follows: Circuit-SAT: given a boolean circuit where we can have logical gates like OR, AND, NOT, determine whether there is a set of inputs such that the output is Truth. Theorem Circuit-SAT is NP-complete. The Circuit-SAT problem seems to be more fundamental, because any complied program is essentially a set of operations of logical gates. For any NP problem q, by definition, there is an algorithm A that check whether x is a solution of q. Now, we transform the algorithm A into a circuit C which takes the input x and check whether x is a solution of q; this transformation can be done by the intuition above. If the Circuit-SAT can be solved in polynomial time, one can use 7

8 the above transformation to determine whether there is a solution to an NP problem in polynomial time. Thus Circuit-SAT is NP-complete. Reduction from Circuit-SAT to SAT: we need to represent the logical gates by the conjunction normal form formulas. For example, to represent an AND gate with input x,y and output z, we can use the following formula: (x y z) (x y z) (x y z) (x y z) The reader can check that the above formula is satisfiable if and only if z behaves as the output of an AND gate with input x,y. For example, the first clause encodes the rule that if x and y are FALSE, then z must also be FALSE in order to satisfy the first clause. We leave it as an exercise to represent an OR gate and a NOT gate by formulas SAT The 3-SAT problem is a special case of SAT: every clause contains exactly 3 literals. However, we show that it is as hard as the SAT problem. Theorem SAT is NP-complete. We reduce SAT to 3-SAT. The idea is to replace every clause by an equivalent collection of three-literal clauses, possibly with some dummy variables. The transformation needs to ensure that the resulting 3CNF 6 is satisfiable if and only if the original CNF is satisfiable. Let s consider a clause with k literals: If k < 1, we replace the clause with multiple clauses and some dummy variables. For example, if the clause is (a), we transform it to: (a α β) (a α β) (a α β) (a α β) and if the clause is (a b), then we transform it into (a b α) (a b α) The key is: to satisfy the new clauses, the truth assignment restricts to the original variables must satisfy the original clauses. If k > 3, we break the clause into several three-literal clauses with dummy variables. For example, if the clause is (a b c d e f), we transform it to: (a b x 1 ) (x 1 c x 2 ) (x 2 d x 3 ) (x 3 e f) If the original clause is satisfiable, say a is assigned TRUE, then one can satisfy the new clauses by setting a TRUE and x 1,x 2,x 3 FALSE. On the other hand, if the new clauses are satisfiable, then one original variable must be TRUE (when all the original variables are FALSE, the new clauses cannot be satisfied simultaneously), and so the original clause is also satisfiable. If k = 3, we are lucky and have nothing to do. 6 3-Conjunction Normal Form 8

9 1.3.4 Vertex Cover Vertex cover of a graph is a set of vertices S such that every edge in the graph has at least one endpoint in S. Given a graph G = (V,E) and an integer k, the Vertex Cover problem is to determine whether G has a vertex cover of size k. Theorem The Vertex Cover problem is NP-complete. Let s reduce 3-SAT to Vertex Cover. Given a formula, the transformed graph has two parts: The variable component : for each variable x, we construct two adjacent vertices corresponding to the literals x and x. The clause component : for each clause, we construct a triangle, with each vertex representing one literal. We also connect vertices in the variable component and the clause component if they correspond to the same literal. For example, suppose we have the following formula: (a b c) (b c d) (a c d) Then the constructive graph is shown in Figure Figure 1.3.7: Reduction from 3-SAT to Vertex Cover. Suppose we have m variables and n clauses in the formula, we will show that the constructive graph has a vertex cover of size m + 2n if and only if the formula is satisfiable. First, if the formula is satisfiable, then there is at least one truth literal in each of the clause. In each corresponding triangle, we left one truth-value vertex and choose the rest two vertices into the vertex cover, we then choose the truth-value vertex in the corresponding variable component. By doing this, we get a vertex cover of size m + 2n. On the other hand, suppose the graph has a vertex cover of size m + 2n. Since each variable component needs at least one vertex in the vertex cover and each clause component needs at 9

10 least two vertices in the vertex cover, we must have the size of a vertex cover is at least m + 2n. Since there is a vertex cover of size m + 2n, there must be exactly one selected vertex in each variable component and two selected vertices in each clause component to cover all the edges. Now we set a variable x to be TRUE if x is chosen in the vertex cover and to be FALSE if x is chosen in the vertex cover. For each clause component, there is one literal w in the triangle not chosen in the vertex cover. Since every edge is covered, the corresponding literal in the variable component must be chosen (because there is an edge between them), and therefore that literal w is satisfied by the truth assignment. This is true for each clause, and so the truth assignment by the vertex cover solution is a satisfying assignment Clique and Independent Set Theorem The Clique problem and Independent Set problem are both NP-complete. We have already shown the reducibility between Clique and Independent Set. The reduction from Vertex Cover to Independent Set is straightforward: a graph of n vertices has a vertex cover of size k if and only if the graph has an independent set of size n k. Therefore we can easily prove that both Clique and Independent Set are NP-complete D-Matching The 3D-Matching problem is a generalization of the marriage problem. We are given a set M = W X Y, where W,X,Y are disjoint sets with equal number (q) of elements. The question is to determine whether M has a matching, i.e., a subset M M such that M = q and no two elements of M agree in any coordinate. We will show that 3D-Matching is NP-complete by reducing 3-SAT to it. Theorem The 3D-Matching problem is NP-complete. The reduction involves a proper gadget design for the 3-SAT formula. We do the following steps: For each variable x, we make a gadget with 2m triangles, where m is the number of clauses. Each triangle has one external vertex, labelled by x or x alternatively; the other two vertices of each triangle are internal vertices, which only appear in exactly two triangles. This gadget is shown in Figure For each clause c, if literal x appears in the clause, then we add two clause vertices c 1,c 2, and add a triangle {c 1,c 2,x} where x is an external vertex of the variable gadget. Note that each external vertex is only used by one clause. An example of the formed structure corresponding to the clause is shown in Figure There are m(n 1) dummy clauses. Each dummy clause d has two vertices d 1,d 2. And there are 2mn triangles for d, each containing d 1,d 2 and an external vertex of a variable. We can see that the variable gadget ensures the consistency of value assignment: to cover all the internal vertices of a variable gadget, either all the x vertices are available or all the x vertices are available. The former corresponds to the case where x is TRUE, where the latter corresponds to the case where x is FALSE. In order to cover the clause vertices c 1,c 2 of a clause c, there must 10

11 Figure 1.3.8: Reduce from 3-SAT to 3DM. be one literal w in that clause available, which implies that clause c is satisfied by the literal w. Therefore, if there is a 3D-matching, the corresponding truth assignment is a satisfying assignment. Each remaining external variable can be covered by a dummy clause. On the other hand, if there is a satisfying assignment, by setting the external vertices x available if and only if x is TRUE, one can find a 3D-matching as in the above argument. Therefore, we have reduced 3-SAT to 3DM Partition and Subset-Sum Theorem The Partition and Subset-Sum (Knapsack) problems are NP-complete. We will reduce 3DM to Subset-Sum. For the 3DM instance, suppose we have n boys, n girls, n pets and some compatible (boy, girl, pet) tuples. We use an n-digit number to represent each boy (or girl or pet), each digit has log n bits, and so can represent a number from 1 to n. For each boy, the corresponding digit is set to be 1, and all other digits are zero. For example, if n = 4 then the No.2 boy will have a number For each (boy, girl, pet) tuple we concatenate their numbers together to form a 3n-digit number. An example of n = 4 is shown in Figure The instance of corresponding Subset-Sum problem is to determine whether the set of numbers x 1,x 2,... have a subset which add up to K, where K is the 3n-digit number with every digit equals to one. There is a subset sum which is equal to K if and only if there is a complete matching for the boys, girls and pets. For each digit, if there is no number in the subset with an 1 in the corresponding 11

12 Figure 1.3.9: Reduce from 3DM to knapsack. digit, then the resulting digit is zero. Also, if there are more than one number with an 1 in the corresponding digit, then the resulting digit is larger than 1, but at most n so that the digit must be different from 1. Therefore, to have a number with a 1 in each digit, this must corresponds to a 3D-matching. This completes the proof of the reduction from 3DM to Subset-Sum Summary of the Techniques in Reduction We have seen a few reductions. Following is a summary for common techniques in the reduction. Restriction: show that a special case of the problem is already NP-complete. Local Replacement: in the transformation, replace some basic unit with a new structure. Component Design: design specific gadgets to represent the constraints or functionalities. Example: Some problems can be easily proven NP-complete by restriction. Minimum Cover: given a collection C of subsets of a set S, and a integer k, determine whether C has a cover for S of size k or less. We can easily reduce 3DM to Minimum Cover, because the former is just a special case of the latter. Subgraph Isomorphism: given two graphs G and H, determine whether G has a subgraph which is isomorphic to H. Restricting H to be a complete graph, we can reduce Clique problem to Subgraph Isomorphism problem. Degree-Bounded Spanning Tree: given a graph G and an integer k, determine whether G has a spanning tree in which the vertex degree is bounded by k. Restricting k = 3, we can reduce Hamiltonian path problem to the Degree-bounded Spanning Tree. Example: An example of Local Replacement: Sequencing with Intervals: given a finite set T of jobs, and each t T has an integer release time r(t) 0, a deadline d(t) Z +, and a processing time l(t) Z +, determine whether there is a 12

13 feasible schedule for the all the jobs (i.e. each job is processed after the release time, not interrupted by other jobs and finished before deadline). We will reduce Partition to Sequencing with Intervals. The instance of Partition is a set A with size s(a) for each a A. Let B = a A s(a). The local replacement for a A is a task t a with r(t a ) = 0 (restriction), d(t) = B +1 and l(t a ) = s(a). Additionally, we add another enforcer job t with r(t ) = B/2, d(t ) = (B + 1)/2 and l(t ) = 1. The enforcer put two restrictions on the feasible job schedule: 1) if B is odd (in which case we do not have equal partition) there is no feasible job schedule because r(t ) = d(t ); 2) assuming B is even, then r(t ) = B/2 and d(t ) = r(t ) + l(t ), such that any feasible schedule must let t to be started at B/2. There are two time blocks (each with length B/2) left and the total amount of available time is equal to the total length of the rest jobs, this means that each block must be filled up exactly, and this can be done if and only if there is an equal partition for A. References [1] M.R. Garey, D.S. Johnson, Computers and Intractability: A Guide to the Theory of NP- Completeness, W. H. Freeman,

1. Introduction Recap

1. Introduction Recap 1. Introduction Recap 1. Tractable and intractable problems polynomial-boundness: O(n k ) 2. NP-complete problems informal definition 3. Examples of P vs. NP difference may appear only slightly 4. Optimization

More information

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions Summary of the previous lecture Recall that we mentioned the following topics: P: is the set of decision problems (or languages) that are solvable in polynomial time. NP: is the set of decision problems

More information

CS 583: Algorithms. NP Completeness Ch 34. Intractability

CS 583: Algorithms. NP Completeness Ch 34. Intractability CS 583: Algorithms NP Completeness Ch 34 Intractability Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time? Standard working

More information

ECS122A Handout on NP-Completeness March 12, 2018

ECS122A Handout on NP-Completeness March 12, 2018 ECS122A Handout on NP-Completeness March 12, 2018 Contents: I. Introduction II. P and NP III. NP-complete IV. How to prove a problem is NP-complete V. How to solve a NP-complete problem: approximate algorithms

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Design and Analysis of Algorithms CSE 5311 Lecture 25 NP Completeness Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms 1 NP-Completeness Some

More information

NP and Computational Intractability

NP and Computational Intractability NP and Computational Intractability 1 Review Basic reduction strategies. Simple equivalence: INDEPENDENT-SET P VERTEX-COVER. Special case to general case: VERTEX-COVER P SET-COVER. Encoding with gadgets:

More information

NP-Complete Reductions 1

NP-Complete Reductions 1 x x x 2 x 2 x 3 x 3 x 4 x 4 CS 4407 2 22 32 Algorithms 3 2 23 3 33 NP-Complete Reductions Prof. Gregory Provan Department of Computer Science University College Cork Lecture Outline x x x 2 x 2 x 3 x 3

More information

Lecture 19: Finish NP-Completeness, conp and Friends

Lecture 19: Finish NP-Completeness, conp and Friends 6.045 Lecture 19: Finish NP-Completeness, conp and Friends 1 Polynomial Time Reducibility f : Σ* Σ* is a polynomial time computable function if there is a poly-time Turing machine M that on every input

More information

NP-Complete Problems. More reductions

NP-Complete Problems. More reductions NP-Complete Problems More reductions Definitions P: problems that can be solved in polynomial time (typically in n, size of input) on a deterministic Turing machine Any normal computer simulates a DTM

More information

NP Complete Problems. COMP 215 Lecture 20

NP Complete Problems. COMP 215 Lecture 20 NP Complete Problems COMP 215 Lecture 20 Complexity Theory Complexity theory is a research area unto itself. The central project is classifying problems as either tractable or intractable. Tractable Worst

More information

Algorithms: COMP3121/3821/9101/9801

Algorithms: COMP3121/3821/9101/9801 NEW SOUTH WALES Algorithms: COMP3121/3821/9101/9801 Aleks Ignjatović School of Computer Science and Engineering University of New South Wales LECTURE 9: INTRACTABILITY COMP3121/3821/9101/9801 1 / 29 Feasibility

More information

Chapter 3: Proving NP-completeness Results

Chapter 3: Proving NP-completeness Results Chapter 3: Proving NP-completeness Results Six Basic NP-Complete Problems Some Techniques for Proving NP-Completeness Some Suggested Exercises 1.1 Six Basic NP-Complete Problems 3-SATISFIABILITY (3SAT)

More information

COP 4531 Complexity & Analysis of Data Structures & Algorithms

COP 4531 Complexity & Analysis of Data Structures & Algorithms COP 4531 Complexity & Analysis of Data Structures & Algorithms Lecture 18 Reductions and NP-completeness Thanks to Kevin Wayne and the text authors who contributed to these slides Classify Problems According

More information

Essential facts about NP-completeness:

Essential facts about NP-completeness: CMPSCI611: NP Completeness Lecture 17 Essential facts about NP-completeness: Any NP-complete problem can be solved by a simple, but exponentially slow algorithm. We don t have polynomial-time solutions

More information

Spring Lecture 21 NP-Complete Problems

Spring Lecture 21 NP-Complete Problems CISC 320 Introduction to Algorithms Spring 2014 Lecture 21 NP-Complete Problems 1 We discuss some hard problems: how hard? (computational complexity) what makes them hard? any solutions? Definitions Decision

More information

Notes for Lecture 21

Notes for Lecture 21 U.C. Berkeley CS170: Intro to CS Theory Handout N21 Professor Luca Trevisan November 20, 2001 Notes for Lecture 21 1 Tractable and Intractable Problems So far, almost all of the problems that we have studied

More information

Show that the following problems are NP-complete

Show that the following problems are NP-complete Show that the following problems are NP-complete April 7, 2018 Below is a list of 30 exercises in which you are asked to prove that some problem is NP-complete. The goal is to better understand the theory

More information

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35. NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979. NP-Completeness 1 General Problems, Input Size and

More information

CS 301: Complexity of Algorithms (Term I 2008) Alex Tiskin Harald Räcke. Hamiltonian Cycle. 8.5 Sequencing Problems. Directed Hamiltonian Cycle

CS 301: Complexity of Algorithms (Term I 2008) Alex Tiskin Harald Räcke. Hamiltonian Cycle. 8.5 Sequencing Problems. Directed Hamiltonian Cycle 8.5 Sequencing Problems Basic genres. Packing problems: SET-PACKING, INDEPENDENT SET. Covering problems: SET-COVER, VERTEX-COVER. Constraint satisfaction problems: SAT, 3-SAT. Sequencing problems: HAMILTONIAN-CYCLE,

More information

Introduction to Complexity Theory

Introduction to Complexity Theory Introduction to Complexity Theory Read K & S Chapter 6. Most computational problems you will face your life are solvable (decidable). We have yet to address whether a problem is easy or hard. Complexity

More information

NP-Completeness. Subhash Suri. May 15, 2018

NP-Completeness. Subhash Suri. May 15, 2018 NP-Completeness Subhash Suri May 15, 2018 1 Computational Intractability The classical reference for this topic is the book Computers and Intractability: A guide to the theory of NP-Completeness by Michael

More information

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P Easy Problems vs. Hard Problems CSE 421 Introduction to Algorithms Winter 2000 NP-Completeness (Chapter 11) Easy - problems whose worst case running time is bounded by some polynomial in the size of the

More information

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA. Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA NP Completeness Susmita Sur-Kolay Advanced Computing and Microelectronics Unit

More information

CMSC 441: Algorithms. NP Completeness

CMSC 441: Algorithms. NP Completeness CMSC 441: Algorithms NP Completeness Intractable & Tractable Problems Intractable problems: As they grow large, we are unable to solve them in reasonable time What constitutes reasonable time? Standard

More information

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015 CS 374: Algorithms & Models of Computation, Spring 2015 NP Completeness Lecture 23 November 19, 2015 Chandra & Lenny (UIUC) CS374 1 Spring 2015 1 / 37 Part I NP-Completeness Chandra & Lenny (UIUC) CS374

More information

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1 NP CS 320, Fall 2017 Dr. Geri Georg, Instructor georg@colostate.edu 320 NP 1 NP Complete A class of problems where: No polynomial time algorithm has been discovered No proof that one doesn t exist 320

More information

Chapter 34: NP-Completeness

Chapter 34: NP-Completeness Graph Algorithms - Spring 2011 Set 17. Lecturer: Huilan Chang Reference: Cormen, Leiserson, Rivest, and Stein, Introduction to Algorithms, 2nd Edition, The MIT Press. Chapter 34: NP-Completeness 2. Polynomial-time

More information

Introduction to Computational Complexity

Introduction to Computational Complexity Introduction to Computational Complexity Tandy Warnow October 30, 2018 CS 173, Introduction to Computational Complexity Tandy Warnow Overview Topics: Solving problems using oracles Proving the answer to

More information

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch] NP-Completeness Andreas Klappenecker [based on slides by Prof. Welch] 1 Prelude: Informal Discussion (Incidentally, we will never get very formal in this course) 2 Polynomial Time Algorithms Most of the

More information

Limitations of Algorithm Power

Limitations of Algorithm Power Limitations of Algorithm Power Objectives We now move into the third and final major theme for this course. 1. Tools for analyzing algorithms. 2. Design strategies for designing algorithms. 3. Identifying

More information

NP Completeness and Approximation Algorithms

NP Completeness and Approximation Algorithms Winter School on Optimization Techniques December 15-20, 2016 Organized by ACMU, ISI and IEEE CEDA NP Completeness and Approximation Algorithms Susmita Sur-Kolay Advanced Computing and Microelectronic

More information

CSE 421 NP-Completeness

CSE 421 NP-Completeness CSE 421 NP-Completeness Yin at Lee 1 Cook-Levin heorem heorem (Cook 71, Levin 73): 3-SA is NP-complete, i.e., for all problems A NP, A p 3-SA. (See CSE 431 for the proof) So, 3-SA is the hardest problem

More information

Complexity, P and NP

Complexity, P and NP Complexity, P and NP EECS 477 Lecture 21, 11/26/2002 Last week Lower bound arguments Information theoretic (12.2) Decision trees (sorting) Adversary arguments (12.3) Maximum of an array Graph connectivity

More information

Introduction. Pvs.NPExample

Introduction. Pvs.NPExample Introduction Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 09 NP-Completeness (Chapter 34) Stephen Scott (Adapted from Vinodchandran N. Variyam) sscott@cse.unl.edu I

More information

Polynomial-time Reductions

Polynomial-time Reductions Polynomial-time Reductions Disclaimer: Many denitions in these slides should be taken as the intuitive meaning, as the precise meaning of some of the terms are hard to pin down without introducing the

More information

NP-Completeness. NP-Completeness 1

NP-Completeness. NP-Completeness 1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979. NP-Completeness 1 General Problems, Input Size and

More information

NP-COMPLETE PROBLEMS. 1. Characterizing NP. Proof

NP-COMPLETE PROBLEMS. 1. Characterizing NP. Proof T-79.5103 / Autumn 2006 NP-complete problems 1 NP-COMPLETE PROBLEMS Characterizing NP Variants of satisfiability Graph-theoretic problems Coloring problems Sets and numbers Pseudopolynomial algorithms

More information

More NP-Complete Problems

More NP-Complete Problems CS 473: Algorithms, Spring 2018 More NP-Complete Problems Lecture 23 April 17, 2018 Most slides are courtesy Prof. Chekuri Ruta (UIUC) CS473 1 Spring 2018 1 / 57 Recap NP: languages/problems that have

More information

Classes of Problems. CS 461, Lecture 23. NP-Hard. Today s Outline. We can characterize many problems into three classes:

Classes of Problems. CS 461, Lecture 23. NP-Hard. Today s Outline. We can characterize many problems into three classes: Classes of Problems We can characterize many problems into three classes: CS 461, Lecture 23 Jared Saia University of New Mexico P is the set of yes/no problems that can be solved in polynomial time. Intuitively

More information

CS 5114: Theory of Algorithms

CS 5114: Theory of Algorithms CS 5114: Theory of Algorithms Clifford A. Shaffer Department of Computer Science Virginia Tech Blacksburg, Virginia Spring 2014 Copyright c 2014 by Clifford A. Shaffer CS 5114: Theory of Algorithms Spring

More information

Discrete Optimization 2010 Lecture 10 P, N P, and N PCompleteness

Discrete Optimization 2010 Lecture 10 P, N P, and N PCompleteness Discrete Optimization 2010 Lecture 10 P, N P, and N PCompleteness Marc Uetz University of Twente m.uetz@utwente.nl Lecture 9: sheet 1 / 31 Marc Uetz Discrete Optimization Outline 1 N P and co-n P 2 N P-completeness

More information

NP-problems continued

NP-problems continued NP-problems continued Page 1 Since SAT and INDEPENDENT SET can be reduced to each other we might think that there would be some similarities between the two problems. In fact, there is one such similarity.

More information

More on NP and Reductions

More on NP and Reductions Indian Institute of Information Technology Design and Manufacturing, Kancheepuram Chennai 600 127, India An Autonomous Institute under MHRD, Govt of India http://www.iiitdm.ac.in COM 501 Advanced Data

More information

Geometric Steiner Trees

Geometric Steiner Trees Geometric Steiner Trees From the book: Optimal Interconnection Trees in the Plane By Marcus Brazil and Martin Zachariasen Part 3: Computational Complexity and the Steiner Tree Problem Marcus Brazil 2015

More information

NP-completeness. Chapter 34. Sergey Bereg

NP-completeness. Chapter 34. Sergey Bereg NP-completeness Chapter 34 Sergey Bereg Oct 2017 Examples Some problems admit polynomial time algorithms, i.e. O(n k ) running time where n is the input size. We will study a class of NP-complete problems

More information

Formal definition of P

Formal definition of P Since SAT and INDEPENDENT SET can be reduced to each other we might think that there would be some similarities between the two problems. In fact, there is one such similarity. In SAT we want to know if

More information

Lecture #14: NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition.

Lecture #14: NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition. Lecture #14: 0.0.1 NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition. 0.0.2 Preliminaries: Definition 1 n abstract problem Q is a binary relations on a set I of

More information

NP-Complete problems

NP-Complete problems NP-Complete problems NP-complete problems (NPC): A subset of NP. If any NP-complete problem can be solved in polynomial time, then every problem in NP has a polynomial time solution. NP-complete languages

More information

COMP 382. Unit 10: NP-Completeness

COMP 382. Unit 10: NP-Completeness COMP 382 Unit 10: NP-Completeness Time complexity 1 log n n n 2 n 3 2 n n n Space complexity 1 log n n n 2 n 3 2 n n n Complexity theory Focus on decidability (yes/no) problems What is P? Deterministic,

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURES 30-31 NP-completeness Definition NP-completeness proof for CIRCUIT-SAT Adam Smith 11/3/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova,

More information

P versus NP. Math 40210, Spring September 16, Math (Spring 2012) P versus NP September 16, / 9

P versus NP. Math 40210, Spring September 16, Math (Spring 2012) P versus NP September 16, / 9 P versus NP Math 40210, Spring 2012 September 16, 2012 Math 40210 (Spring 2012) P versus NP September 16, 2012 1 / 9 Properties of graphs A property of a graph is anything that can be described without

More information

DESIGN AND ANALYSIS OF ALGORITHMS. Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

DESIGN AND ANALYSIS OF ALGORITHMS. Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS DESIGN AND ANALYSIS OF ALGORITHMS Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS http://milanvachhani.blogspot.in COMPLEXITY FOR THE IMPATIENT You are a senior software engineer in a large software

More information

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS DESIGN AND ANALYSIS OF ALGORITHMS Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS http://milanvachhani.blogspot.in COMPLEXITY FOR THE IMPATIENT You are a senior software engineer in a large software

More information

NP-Completeness Review

NP-Completeness Review CS124 NP-Completeness Review Where We Are Headed Up to this point, we have generally assumed that if we were given a problem, we could find a way to solve it. Unfortunately, as most of you know, there

More information

SAT, NP, NP-Completeness

SAT, NP, NP-Completeness CS 473: Algorithms, Spring 2018 SAT, NP, NP-Completeness Lecture 22 April 13, 2018 Most slides are courtesy Prof. Chekuri Ruta (UIUC) CS473 1 Spring 2018 1 / 57 Part I Reductions Continued Ruta (UIUC)

More information

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer Science University of Virginia www.cs.virginia.edu/~njb2b/theory

More information

NP-Completeness. NP-Completeness 1

NP-Completeness. NP-Completeness 1 NP-Completeness x x x 2 x 2 x 3 x 3 x 4 x 4 2 22 32 3 2 23 3 33 NP-Completeness Outline and Reading P and NP ( 3.) Definition of P Definition of NP Alternate definition of NP NP-completeness ( 3.2) Definition

More information

5. Complexity Theory

5. Complexity Theory Course: Combinatorial Optimisation DOCUMENT LAST MODIFIED: MARCH 2, 2011 VU University Amsterdam 5. Complexity Theory Guido Schäfer March 2011 These lecture notes cover the material of the lectures given

More information

NP-Complete Reductions 2

NP-Complete Reductions 2 x 1 x 1 x 2 x 2 x 3 x 3 x 4 x 4 12 22 32 CS 447 11 13 21 23 31 33 Algorithms NP-Complete Reductions 2 Prof. Gregory Provan Department of Computer Science University College Cork 1 Lecture Outline NP-Complete

More information

Chapter 3. Complexity of algorithms

Chapter 3. Complexity of algorithms Chapter 3 Complexity of algorithms In this chapter, we see how problems may be classified according to their level of difficulty. Most problems that we consider in these notes are of general character,

More information

NP-Completeness. Until now we have been designing algorithms for specific problems

NP-Completeness. Until now we have been designing algorithms for specific problems NP-Completeness 1 Introduction Until now we have been designing algorithms for specific problems We have seen running times O(log n), O(n), O(n log n), O(n 2 ), O(n 3 )... We have also discussed lower

More information

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office? N P NP Completeness Announcements Friday Four Square! Today at 4:15PM, outside Gates. Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Explore P, NP, and their connection. Did

More information

Lecture 18: More NP-Complete Problems

Lecture 18: More NP-Complete Problems 6.045 Lecture 18: More NP-Complete Problems 1 The Clique Problem a d f c b e g Given a graph G and positive k, does G contain a complete subgraph on k nodes? CLIQUE = { (G,k) G is an undirected graph with

More information

P, NP, NP-Complete, and NPhard

P, NP, NP-Complete, and NPhard P, NP, NP-Complete, and NPhard Problems Zhenjiang Li 21/09/2011 Outline Algorithm time complicity P and NP problems NP-Complete and NP-Hard problems Algorithm time complicity Outline What is this course

More information

Computational Complexity. IE 496 Lecture 6. Dr. Ted Ralphs

Computational Complexity. IE 496 Lecture 6. Dr. Ted Ralphs Computational Complexity IE 496 Lecture 6 Dr. Ted Ralphs IE496 Lecture 6 1 Reading for This Lecture N&W Sections I.5.1 and I.5.2 Wolsey Chapter 6 Kozen Lectures 21-25 IE496 Lecture 6 2 Introduction to

More information

8.5 Sequencing Problems

8.5 Sequencing Problems 8.5 Sequencing Problems Basic genres. Packing problems: SET-PACKING, INDEPENDENT SET. Covering problems: SET-COVER, VERTEX-COVER. Constraint satisfaction problems: SAT, 3-SAT. Sequencing problems: HAMILTONIAN-CYCLE,

More information

CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1

CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1 CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY E. Amaldi Foundations of Operations Research Politecnico di Milano 1 Goal: Evaluate the computational requirements (this course s focus: time) to solve

More information

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9 1 Computational Complexity and Intractability: An Introduction to the Theory of NP Chapter 9 2 Objectives Classify problems as tractable or intractable Define decision problems Define the class P Define

More information

Complexity theory for fellow CS students

Complexity theory for fellow CS students This document contains some basics of the complexity theory. It is mostly based on the lecture course delivered at CS dept. by Meran G. Furugyan. Differences are subtle. Disclaimer of warranties apply:

More information

P versus NP. Math 40210, Fall November 10, Math (Fall 2015) P versus NP November 10, / 9

P versus NP. Math 40210, Fall November 10, Math (Fall 2015) P versus NP November 10, / 9 P versus NP Math 40210, Fall 2015 November 10, 2015 Math 40210 (Fall 2015) P versus NP November 10, 2015 1 / 9 Properties of graphs A property of a graph is anything that can be described without referring

More information

Computational complexity theory

Computational complexity theory Computational complexity theory Introduction to computational complexity theory Complexity (computability) theory deals with two aspects: Algorithm s complexity. Problem s complexity. References S. Cook,

More information

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k.

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k. Complexity Theory Problems are divided into complexity classes. Informally: So far in this course, almost all algorithms had polynomial running time, i.e., on inputs of size n, worst-case running time

More information

NP and NP Completeness

NP and NP Completeness CS 374: Algorithms & Models of Computation, Spring 2017 NP and NP Completeness Lecture 23 April 20, 2017 Chandra Chekuri (UIUC) CS374 1 Spring 2017 1 / 44 Part I NP Chandra Chekuri (UIUC) CS374 2 Spring

More information

NP-problems continued

NP-problems continued NP-problems continued Page 1 Since SAT and INDEPENDENT SET can be reduced to each other we might think that there would be some similarities between the two problems. In fact, there is one such similarity.

More information

4/19/11. NP and NP completeness. Decision Problems. Definition of P. Certifiers and Certificates: COMPOSITES

4/19/11. NP and NP completeness. Decision Problems. Definition of P. Certifiers and Certificates: COMPOSITES Decision Problems NP and NP completeness Identify a decision problem with a set of binary strings X Instance: string s. Algorithm A solves problem X: As) = yes iff s X. Polynomial time. Algorithm A runs

More information

Correctness of Dijkstra s algorithm

Correctness of Dijkstra s algorithm Correctness of Dijkstra s algorithm Invariant: When vertex u is deleted from the priority queue, d[u] is the correct length of the shortest path from the source s to vertex u. Additionally, the value d[u]

More information

Lecture 19: NP-Completeness 1

Lecture 19: NP-Completeness 1 Lecture 19: NP-Completeness 1 Revised Sun May 25, 2003 Outline of this Lecture Polynomial-time reductions. CLRS pp.984-5 The class N PC. CLRS p. 986 Proving that problems are N PC. SAT, CLIQUE, INDEPENDENT

More information

CSE 548: (Design and) Analysis of Algorithms

CSE 548: (Design and) Analysis of Algorithms 1 / 38 CSE 548: (Design and) Analysis of Algorithms NP and Complexity Classes R. Sekar 2 / 38 Search and Optimization Problems Many problems of our interest are search problems with exponentially (or even

More information

Computational complexity theory

Computational complexity theory Computational complexity theory Introduction to computational complexity theory Complexity (computability) theory deals with two aspects: Algorithm s complexity. Problem s complexity. References S. Cook,

More information

8. INTRACTABILITY I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 2/6/18 2:16 AM

8. INTRACTABILITY I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 2/6/18 2:16 AM 8. INTRACTABILITY I poly-time reductions packing and covering problems constraint satisfaction problems sequencing problems partitioning problems graph coloring numerical problems Lecture slides by Kevin

More information

Lecture 18: P & NP. Revised, May 1, CLRS, pp

Lecture 18: P & NP. Revised, May 1, CLRS, pp Lecture 18: P & NP Revised, May 1, 2003 CLRS, pp.966-982 The course so far: techniques for designing efficient algorithms, e.g., divide-and-conquer, dynamic-programming, greedy-algorithms. What happens

More information

Part V. Intractable Problems

Part V. Intractable Problems Part V Intractable Problems 507 Chapter 16 N P-Completeness Up to now, we have focused on developing efficient algorithms for solving problems. The word efficient is somewhat subjective, and the degree

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 31 P and NP Self-reducibility NP-completeness Adam Smith 12/1/2008 S. Raskhodnikova; based on slides by K. Wayne Central ideas we ll cover Poly-time as feasible most

More information

COMP Analysis of Algorithms & Data Structures

COMP Analysis of Algorithms & Data Structures COMP 3170 - Analysis of Algorithms & Data Structures Shahin Kamali Computational Complexity CLRS 34.1-34.4 University of Manitoba COMP 3170 - Analysis of Algorithms & Data Structures 1 / 50 Polynomial

More information

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013 Chapter 2 Reductions and NP CS 573: Algorithms, Fall 2013 August 29, 2013 2.1 Reductions Continued 2.1.1 The Satisfiability Problem SAT 2.1.1.1 Propositional Formulas Definition 2.1.1. Consider a set of

More information

INTRO TO COMPUTATIONAL COMPLEXITY

INTRO TO COMPUTATIONAL COMPLEXITY MA/CSSE 473 Day 38 Problems Decision Problems P and NP Polynomial time algorithms INTRO TO COMPUTATIONAL COMPLEXITY 1 The Law of the Algorithm Jungle Polynomial good, exponential bad! The latter is obvious,

More information

SAT, Coloring, Hamiltonian Cycle, TSP

SAT, Coloring, Hamiltonian Cycle, TSP 1 SAT, Coloring, Hamiltonian Cycle, TSP Slides by Carl Kingsford Apr. 28, 2014 Sects. 8.2, 8.7, 8.5 2 Boolean Formulas Boolean Formulas: Variables: x 1, x 2, x 3 (can be either true or false) Terms: t

More information

CS 350 Algorithms and Complexity

CS 350 Algorithms and Complexity 1 CS 350 Algorithms and Complexity Fall 2015 Lecture 15: Limitations of Algorithmic Power Introduction to complexity theory Andrew P. Black Department of Computer Science Portland State University Lower

More information

Computers and Intractability. The Bandersnatch problem. The Bandersnatch problem. The Bandersnatch problem. A Guide to the Theory of NP-Completeness

Computers and Intractability. The Bandersnatch problem. The Bandersnatch problem. The Bandersnatch problem. A Guide to the Theory of NP-Completeness Computers and Intractability A Guide to the Theory of NP-Completeness The Bible of complexity theory Background: Find a good method for determining whether or not any given set of specifications for a

More information

4/22/12. NP and NP completeness. Efficient Certification. Decision Problems. Definition of P

4/22/12. NP and NP completeness. Efficient Certification. Decision Problems. Definition of P Efficient Certification and completeness There is a big difference between FINDING a solution and CHECKING a solution Independent set problem: in graph G, is there an independent set S of size at least

More information

Recap from Last Time

Recap from Last Time NP-Completeness Recap from Last Time Analyzing NTMs When discussing deterministic TMs, the notion of time complexity is (reasonably) straightforward. Recall: One way of thinking about nondeterminism is

More information

CSCI3390-Lecture 17: A sampler of NP-complete problems

CSCI3390-Lecture 17: A sampler of NP-complete problems CSCI3390-Lecture 17: A sampler of NP-complete problems 1 List of Problems We now know that if L is any problem in NP, that L P SAT, and thus SAT is NP-hard. Since SAT is also in NP we find that SAT is

More information

Lecture 13, Fall 04/05

Lecture 13, Fall 04/05 Lecture 13, Fall 04/05 Short review of last class NP hardness conp and conp completeness Additional reductions and NP complete problems Decision, search, and optimization problems Coping with NP completeness

More information

Computers and Intractability

Computers and Intractability Computers and Intractability A Guide to the Theory of NP-Completeness The Bible of complexity theory M. R. Garey and D. S. Johnson W. H. Freeman and Company, 1979 The Bandersnatch problem Background: Find

More information

NP-Hardness reductions

NP-Hardness reductions NP-Hardness reductions Definition: P is the class of problems that can be solved in polynomial time, that is n c for a constant c Roughly, if a problem is in P then it's easy, and if it's not in P then

More information

Instructor N.Sadagopan Scribe: P.Renjith. Lecture- Complexity Class- P and NP

Instructor N.Sadagopan Scribe: P.Renjith. Lecture- Complexity Class- P and NP Indian Institute of Information Technology Design and Manufacturing, Kancheepuram Chennai 600 127, India An Autonomous Institute under MHRD, Govt of India http://www.iiitdm.ac.in COM 501 Advanced Data

More information

Algorithms Design & Analysis. Approximation Algorithm

Algorithms Design & Analysis. Approximation Algorithm Algorithms Design & Analysis Approximation Algorithm Recap External memory model Merge sort Distribution sort 2 Today s Topics Hard problem Approximation algorithms Metric traveling salesman problem A

More information

NP and NP-Completeness

NP and NP-Completeness CSC 364S Notes University of Toronto, Spring, 2003 NP NP and NP-Completeness NP is a class of languages that contains all of P, but which most people think also contains many languages that aren t in P.

More information

4/12/2011. Chapter 8. NP and Computational Intractability. Directed Hamiltonian Cycle. Traveling Salesman Problem. Directed Hamiltonian Cycle

4/12/2011. Chapter 8. NP and Computational Intractability. Directed Hamiltonian Cycle. Traveling Salesman Problem. Directed Hamiltonian Cycle Directed Hamiltonian Cycle Chapter 8 NP and Computational Intractability Claim. G has a Hamiltonian cycle iff G' does. Pf. Suppose G has a directed Hamiltonian cycle Γ. Then G' has an undirected Hamiltonian

More information