# Lecture 14 - P v.s. NP 1

Size: px
Start display at page:

## Transcription

1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford February 27, 2018 Lecture 14 - P v.s. NP 1 In this lecture we start Unit 3 on NP-hardness and approximation algorithms. Up to this point in the class our focus has been on developing fast algorithms for precisely solving combinatorial problems. At times we have touched upon problems which we said were more computationally dicult or provided fast algorithms for approximating the answer to a problem. However, we did this without any formal justication of the diculty of these problems. In this unit we discuss techniques for identifying problems that are dicult to solve exactly and approximately solving them when exact solutions seem computationally infeasible to come by. In this lecture, we start the unit by introducing a notion of problem hardness known as NP-hardness and a broad prevalent class of hard problems known as NP-complete problems. In the next lecture we build upon this to classify the complexity of a number of problems by showing that they are NP-complete. 1 Problem Difficulty We begin this unit by discussing how we might hope to establish the diculty of a problem and motivating the notion of diculty we will work with. Up to now our focus has been on easy problems, i.e. problems that we can obtain fast running times for. Some examples include the following: Global minimum cut - we saw that we can compute this in polynomial time deterministicaly by solving for the maximum s-t ow between any s and every t and that faster algorithms could be achieved by employing randomized algorithms. Minimum weight spanning tree (MST) - we saw how to compute this in nearly linear time by using the greedy algorithm. Bipartiteness - we saw how to check if a graph is bipartite using breadth rst search (BFS). Shortest path - we saw how to compute the shortest path in a graph in nearly linear time by variants of the reachability algorithm. Here our notion of easy was that of being able to solve the problem in polynomial time. While each problem had a trivial exponential time algorithm we showed that we could obtain a much faster polynomial time algorithm and in some cases closer to nearly linear time. As we discussed in the beginning of the course, while certain polynomial running times may be prohibitively expensive in practice for large enough instances the classication of a problem as polynomial time solvable is in many cases a good indicator that fast practical algorithms may be achievable. In contrast to these easy problems, there are is a very broad class of combinatorial problems for which we have exponential time algorithms and yet, not signicantly faster or polynomial time algorithm is known. For example, even slight modications to the problems above induce problems for which we do not know of polynomial time algorithms. A few examples include the following. 1 These lecture notes are a work in progress and there may be typos, awkward language, omitted proof details, etc. Moreover, content from lectures might be missing. These notes are intended to converge to a polished superset of the material covered in class so if you would like anything claried, please do not hesitate to post to Piazza and ask.

2 CME 305: Discrete Mathematics and Algorithms - Lecture 14 2 Maximum cut - in this problem we have an undirected graph and we wish to compute the set of vertices such that the number of edges cut is largest. This the problem induced by ipping form minimization to maximization in the minimum cut problem. Minimum spanning k connected graph - in this problem we have a weighted graph undirected graph and wish to compute the subgraph of minimum weight that is k connected, i.e. at least k edges have to be removed to disconnect this graph. For k = 1 this problem is exactly the MST problem, however for k > 1 this problem becomes hard k-colorability - in this problem we have a undirected unweighted graph G = (V, E) and wish to assign every vertex one of k values, i.e. nd l : V [k] such that for {i, j} E it is the case that l(i) l(j), i.e. for every edge each endpoint is assigned a dierent color. Note that for k = 2 this problem is exactly the problem of checking if a graph is bipartite, however for k > 2 this problem becomes hard. Longest path - in this problem we have a directed graph G = (V, E) and for two vertices s, t V we wish to compute the simple path from s-t with the most edges (i.e. the longest simple path). Now how would we show these problems are hard? For each of these problems the best known running time is exponential and therefore we could simply try to prove that these problems actually require exponential time to solve. Even easier, if we are classifying problems as easy if they are polynomial time solveable, we could more simply just try to prove that these problems are not solvable in polynomial time. While this is a ne and natural approach. Unfortunately, the problem of proving such polynomial time lower bounds on these sorts of problems is incredibly dicult. There are numerous problems like the ones listed above for which no polynomial time algorithm is known and there has been extensive research for decades attempting to provide lower bounds on the running time need to solve these problems. Unfortunately, after signicant eort the current best time lower bound results are not even able to rule out that these problems are solvable in nearly linear time, much less polynomial time. So what should we do in the face of this diculty? We would still like machinery to identify problems as dicult or in some way possibly separate from easy polynomial time algorithms we know. Ideally, such machinery so when faced with a new problem we can quickly and easily build some evidence for whether it falls in the class of easy problems or hard problems are something else. The classic approach towards solving this problem is that rather than directly attempt to show the hard problems are dicult, instead we might hope to show that they are equivalent to each other or equally dicult in some way. This would allow us to at least focus our study of these dicult problems on a few canonical problems rather than each individually. It would also allow us to better identify these hard problems should we encounter them in theory and practice and such equivalence machinery could even possibly allow us to use algorithms for one problem to inform the design of algorithms for another. This is the approach we will take in this class and in the next section we formally introduce the notion of equivalence we will consider. 2 Polynomial Time Reducibility In light of the discussion in the previous section to reason about possibly computationally dicult problems we wish to have a means of comparing dierent problems and possibly showing that they are equivalent. While there are many such notions one could consider the one we will focus on in this class is that of polynomial time reducibility formally dened below. Denition 1 (Polynomial Time Reducibility). We say problem X is polynomial time reducible to problem Y, denoted X p Y if and only if there exists an algorithm for solving X in in polynomial time plus the

3 CME 305: Discrete Mathematics and Algorithms - Lecture 14 3 time needed to solve Y a polynomial number of times on polynomially sized input. We dene X = p Y to denote the condition that X p Y and Y p X. Intuitively X p Y should be interpreted as roughly saying that Y is at least as hard X up to polynomial time. Since our goal is to reason about whether or not problems are possibly polynomial time solveable, this denition is natural. The statement X p Y is saying that ignoring the impact of polynomial factors X is easier than Y and X = p Y is saying that these problems are equivalent. To gain further intuition on this notion consider the following easy lemmas. Lemma 2. If X p Y and Y can be solved in polynomial time then so can X. Proof. Since X p Y there is an algorithm that solves X in polynomial time plus the time needed to solve Y a polynomial number of times on polynomial sized input. Simply running this algorithm using a polynomial time algorithm for Y yields a polynomial time algorithm for X since a polynomial of a polynomial is a polynomial. Lemma 3. If X p Y and X cannot be solved in polynomial time, then neither can Y. Proof. This is simply the contrapositive of the previous lemma. These lemmas further motivate the utility of polynomial time reductions in understanding the class of polynomial time solvable problems. The lemmas imply that if X = p Y then either both X and Y are solveable in polynomial time or neither of them are. Consequently for the sake of understanding whether or not problems are equivalent up to polynomial time, we simply need to provide polynomial time reductions between them. Moreover, as we show in the following lemma, polynomial time reducibility is transitive so we by providing polynomial time reductions between problems we can hope to identify a broad class of problems that are polynomial time reducible to each other. Therefore, while it might be dicult to formally separate the hard problems we have discussed from polynomial time solvable problems, we can at least possibly show that they are either all polynomial time solveable or none are. Lemma 4. If X p Y and Y p Z then X p Z. Proof. By assumption we can solve X in polynomial time plus the time needed to solve Y a polynomial number of times on polynomial sized input and in turn we can solve Y in polynomial time plus the time needed to solve Z a polynomial number of times on polynomial sized input. By simply running this algorithm for X implementing each solve of Y with the algorithm that reduced Y to Z yields an algorithm for solving X in polynomial time plus the time needed to solve Z a polynomial number of times on polynomial sized input, where here we are leveraging the fact that a polynomial of a polynomial is a polynomial. 2.1 Example - Vertex Cover and Independent Set As a quick example of polynomial time reducibility consider the following natural problems on an undirected graph. Denition 5 (Vertex Cover). For undirected G = (V, E) a set S V is a vertex cover if and only if every edge e = {i, j} E has at least one of its endpoints in S, i.e. e S 1. The minimum vertex cover problem asks to nd a vertex cover with a minimum number of vertices. Note that clearly V is a vertex cover of a graph, so nding a vertex cover is always trivial. Furthermore, the minimum vertex cover can always be found in exponential time simply by enumerating over all sets and

4 CME 305: Discrete Mathematics and Algorithms - Lecture 14 4 checking if they constitute a vertex cover and then outputting the one of minimum size. However, there is no polynomial time algorithm known for this problem. Denition 6 (Independent Set). For undirected G = (V, E) a set S V is an independent set if and only if every edge e = {i, j} E it is not the case that both its endpoints are in S, i.e. at least one of its endpoints is not in S or equivalently, e S 1. The maximum independent set problem asks to nd an independent set with a maximum number of vertices. Similar to vertex cover, note that clearly is an independent set in a graph, so nding an independent set is always trivial. Furthermore, the maximum independent set can always be found in exponential time simply by enumerating over all sets and checking if they constitute an independent set and then outputting the one of maximum size. However, there is no polynomial time algorithm known for this problem. Even though both of these problems are suspected to be hard we can easily show that they are polynomial time reducible to each other. Lemma 7. Minimum Vertex Cover = p Maximum Independent Set. Proof. Given G = (V, E) we claim that S V is a vertex cover if and only if V \ S is an independent set. To see this, let e E be arbitrary. Note that trivially e S + e (V \ S) = 2. Consequently, e S 1 if and only if e (V \ S) 1 and S is an independent set, i.e. e S 1 for all e E, if and only if e (V \ S) 1 for all e E, i.e. V \ S is an independent set. Consequently, to compute the minimum vertex cover we can simply compute the maximum independent set and return its complement as the minimum vertex cover and therefore Minimum Vertex Cover p Maximum Independent Set. Similarly, compute the maximum independent set we can simply compute the minimum vertex cover and return its complement as the maximum independent set and therefore Maximum Independent Set p Minimum Vertex Cover. 3 NP-Completeness Now, given this notion of polynomial time reducibility, what we would like to do is show that a broad class of commonly occurring problems for which we do not have polynomial time algorithms are polynomial time reducible to each other. However, to do this what we would like to have is a slightly clearer characterization of this class of hard problems, rather than just those reducible from some particular problem. Here we formally introduce this class of hard problems known as NP-complete problems. 3.1 Decision Problems Before introducing this class of problems we wish to simplify the discussion of algorithm problems more broadly. Up to this point our focus has been on the discussion of optimization problems, i.e. problems where we wish to minimize or maximize some quantity, and on search problems, where we wish to output the best answer like a subgraph or a cut or a coloring. We will nd it more convenient to instead focus on decision problems, i.e. problems where the answer is just yes or no or true or false. For example, rather than considering the minimum vertex cover or maximum independent set problems we will consider the decision problem variants of does G have a vertex cover of size k or does G have an independent set of size k. Furthermore, rather than considering the problem of nding the maximum cut in a graph or nding the 3-coloring of a graph we will focus on the decision variants, does G have a cut of size k or does G have a 3-coloring?

5 CME 305: Discrete Mathematics and Algorithms - Lecture 14 5 Note that we will not lose much typically by focusing on decision problems rather than search or optimization problems as the latter are often polynomial time reducible to the former. For example if we want to know the size of the maximum independent set or maximum cut we can simply binary search on k to nd it with only a O(log n) loss in running time. Similarly, if we want to nd the actual maximum cut or maximum independent set we can simply make a a guess at whether or not a vertex is in the independent set or two vertices are in the same side of the maximum cut and see if the value of the problem changes, similar as we did to reduce checking if a graph has a perfect matching to nding a maximum matching. This causes only a polynomial loss in running time. 3.2 Decision Problem Formalism We focus on decision problems as it allows us to simplify some of the reduction theory and notation regarding the specication of a problem. Moreover, as we discussed in the previous subsection we can do this without loss of generality. Formally, we can think of an instance of a decision problem as simply a sequence of ones and zeros, that we call a binary string, i.e. s {0, 1} k where we use s = k to denote the length of the string. This binary string encodes the input to the problem, for instance the graph and k for maximum independent set. Now since the output of a decision problem is simply yes or no we can simply denote the set of inputs corresponding to a yes output as some X that is a subset of all strings. Note that this X fully characterizes a decision problem. For input binary string s we have s X if and only if the output on s should be yes and s / X if and only if the output on s should be no. Consequently, we can think of a decision problem as just determining or deciding whether or not an input binary string is in X and we can simply dene the problem as this set X. With this formalism in place we can formally dene P, the set of decision problems solvable in polynomial time as follows: Denition 8 (P ). A decision problem X is polynomial time solvable, denoted X P, if and only if there is an algorithm that given any binary string s can compute or decide if s X in time polynomial in s. Note that how the input is represented is important for the denition of P. For example, if we encoded an instance of maximum cut by writing down both the graph and every possible cut as the string, then this string would have length exponential in the size of the graph and deciding if this graph has a large cut would be trivially linear time. Consequently, for the problems we consider we will typically assume they have the natural representation of specifying things like a graph in Õ(n + m) bits or a number in Õ(1) bits. 3.3 NP-Hard Problems We now have everything we need to dene the problem class which characterizes the class of hard problems we have considered so far. To motivate this class, note that a common property across all the hard decision problems we have consider so far. For each of these problems, in the case when the answer is yes there is a proof that we can use to verify in polynomial time that is the case. For example, if the size of the maximum cut is k then given the maxcut we can easily verify that it has this property. Similarly, if a graph is 3-colorable or it does have an independent set of size k we can check that a coloring is a valid coloring or that an independent set is of size k each in polynomial time. Formally, this class of decision problems for which the yes instances are polynomial time veriable is known as NP the class of algorithms solvable in non-deterministic polynomial time. In the following we formally dene this notion of verication and N P. Denition 9 (NP ). A decision problem X is solvable in nondeterministic polynomial time, denoted X NP, if and only if there is a polynomial time verier for X, that is there is an algorithm B that given binary

6 CME 305: Discrete Mathematics and Algorithms - Lecture 14 6 strings s and t output B(s, t) { yes, no } in time polynomial in s + t with the property that if binary string s / X then B(s, t) = no for all t and if s X then there exists t with t = O(poly( s )) such that B(s, t) = yes. We call B a verier as we can use its output to verify whether or not a binary string s X as we can simply search over all t to see if B(s, t) = yes for all t. This happens if and only if s X. We call B ecient as it runs in polynomial time and will run in polynomial time for the t with t = O(poly( s )) for the t such that B(s, t) = yes in the case when s X. Consequently, we can think of t as a candidate proof of the fact that s X and B as the algorithm that veries such proofs. The class NP is called non-deterministic polynomial time as given an algorithm which can guess t we can solve the problem in polynomial time. This guessing is known as non-determinism. For further information, the curious reader should consult one of the many wonderful texts on complexity and automata theory. Now, note that the decision version of each of the hard problems we have considered so far is in NP as we have argued. Furthermore, we can trivially show the following. Lemma 10. P NP. Proof. If X P then the algorithm which given binary string s and t simply uses a polynomial time algorithm to determine s X and output yes if s X and no otherwise is a polynomial time verier for X. Consequently, the running times for solving problems in P are in the worst case no larger than those for solving problems in NP. However, as we have suggested it is not known actually known that the class NP are actually harder than those in P. In other words whether or not NP P and therefore P = NP is open. It is one of the largest open problems in theoretical computer science and one of the Millenium Prize problems for which a resolution would earn you at least a million dollars. Given this issue, as we have discussed our goal instead is to use NP to classify the computational complexity of our hard problems. To do this, we will argue that the problems we have consider are not only in NP, but they are (up to polynomial time reductions) the hardest problems in NP. Formally we dene the following complexity classes. Denition 11 (NP -Hardness and Completeness). A decision problem X is said to be NP -hard if for all Y NP it is the case that Y p X. If additional X NP then X is said to be NP -complete. In other words, we say a problem is NP -hard if it is at least as hard (in the sense of polynomial time reductions) as every problem in NP and it is complete if it is NP as well. Consequently, a problem is NP -complete if it is of the hardest problems in NP. One of the nice things about this denition is that if we had one NP -complete problem then we would have an easy recipe for proving that some other problem is NP -complete as well, simply prove it is NP and reduce the NP -complete problem to it. Lemma 12. If X is NP -complete and X p Y for Y NP then Y is NP -complete as well. Proof. Since X p Y by the transitivity of polynomial time reductions and the denition of NP -completeness we have that for all Z NP it is the case that Z Y and therefore Y is NP-hard. Since Y is assumed to be NP -complete as well the result follows by the denition of NP -completeness. Consequently, the notion of the NP -completeness has the hope of meeting our objectives. It has a nice interpretation that seems not too adhoc or tied to a particular problem and it comes with a recipe for showing that new problems are NP -complete as well. Thus we might hope to easily show that many

7 CME 305: Discrete Mathematics and Algorithms - Lecture 14 7 problems are NP -complete if only we could show that one problem is NP -complete. In fact, this can be shown, that all the hard problems we have considered so far are NP -complete. However, there is a key missing step in following this program of developing the class of NP -complete problems. In particular, it is not clear any such problem exists. How do we know it isn't the case that there is a hierarchy of increasingly hard problems in NP and none that is harder than all? If P = NP then clearly this would not be the case (as every problem in P would be NP -complete trivially) however as we have discussed we are far away from doing this. Fortunately, there were breakthrough results in the early 1971 independently by Cook and Levin that showed in fact this is not the case and that there are NP-complete problems. Since there breakthrough a broad class of problems has been shown to be NP -complete and this has been a major intellectual export of theoretical computer science to many communities in this ability to give evidence of problem diculty. In the remainder of this lecture we will provide a sketch of the proof that a problem is NP -complete and in the next lecture we will use the fact that this problem is NP -complete to show that many more problems are NP -complete. 4 Circuit Satisfiability is N P -complete Here we dene the problem of circuit satisability, or circuit-sat, and sketch the proof that is NP -complete. This problem will serve as the basis for showing that a broader class of problems are NP -complete. Note that the denition of a problem being NP -complete is tied only to the idea of a verier running in polynomial time. Consequently, to show that circuit-sat is N P -complete we will end up showing that we can encode the computation of this verier in some other problem. To do this formally involves being very formal about the notion of computation we are using and typically involves dening things like Turing Machines. This formal notion is a bit outside the scope of this class and therefore the proof that we provide that circuit-sat is NP -complete will only be a sketch. If you would like to see a more formal proof of the fact that circuit-sat is NP-complete I would encourage you to take a course in complexity theory or automata theory or consult one of the wonderful texts on this subject. Now to formally dene the circuit-sat problem we need to formally dene a Boolean circuit. Denition 13 (Boolean Circuit). A Boolean circuit is dened by Boolean variables x 1,..., x k and a connected tree with edges oriented from the leaves towards a root with the following properties: Each leaf node is labeled with one of x i, T for true, or F for false Each internal node is labeled with one of for Boolean or, for Boolean and, or for Boolean not Each and node has in-degree 2 and each node has in-degree node Given an assignment of the variables x i, i.e. setting each x i to either T for true or F for false the outgoing edge of each internal node is labeled with the result of applying the Boolean operation of that node to each of the input and the evaluation of the circuit is said to be the Boolean value corresponding to applying the Boolean operation of the root node to its input. If the output of the circuit is T the circuit is said to evaluate to true and if the output of the circuit is F the circuit is said to evaluate to false. Note that a Boolean circuit is simply a particular way of representing a Boolean formula and that the evaluation of the Boolean circuit as dened above is simply the evaluation of the Boolean formula in the standard sense. Given this denition of a Boolean Circuit the Circuit-SAT problem is dened as follows.

8 CME 305: Discrete Mathematics and Algorithms - Lecture 14 8 Denition 14 (Circuit-SAT). The circuit satisability problem, or circuit-sat, is the problem of given a Boolean circuit determining if their is an assignment of the variables that causes the circuit to evaluate to true. Consequently, the Circuit-SAT problem is simply the problem of determining if the associated Boolean formula is identically false or not. In the remainder of this lecture we simply sketch the proof that Circuit- SAT is NP-complete. Theorem 15. Circuit-SAT is N P -complete. Proof Sketch. As with the proof that any problem is NP -complete, the proof usually starts with the easy part of proving that the problem is in NP. For Circuit-SAT as with many problems, this is quite simple. Given an assignment of the Boolean variables, we can clearly evaluate the circuit in linear time and therefore check if it is a satisfying assignment in linear time. Consequently, there is a polynomial time verier which simply considers the proof string t as a candidate satisfying assignment. Now the much harder part of the proof is to prove that Circuit-SAT is NP -complete. Since we have not yet established that any problem is NP -complete we will need to prove this by appealing directly to the denition of NP. Let X NP be arbitrary. By denition, we know that X has a polynomial time verier, that is B which takes as input binary strings s and t, runs in time polynomial in s + t and always outputs F if s / X and outputs T for some t with t = O(poly( s )) when s X. Now what we wish to do is in polynomial time encode the execution of B as a Boolean circuit which is polynomial size s and has a satisfying assignment if and only if there exists a t with t = O(poly( s )) such that B(s, t) = T. If we could do this, then by solving circuit-sat we could check if s X in polynomial time plus the time to solve circuit-sat on this polynomial size input. Consequently, if we can do this, then X p Circuit SAT and Circuit-SAT is NP -complete as desired. To do this encoding, let's x the input length of s as s = k. Note that B runs in time at most c where c = O(poly(k)). Consequently, B uses space at most m for m = O(poly(k)) and thus we can encode the state for B at each time step i [m] as some Boolean string s i {0, 1} m. Now we can assume that s 1 is simply s concatenated with the string t, i.e. the input to B. Furthermore, we can assume without loss of generality that B in the case when it outputs true sets its nal state to some string s T and when it outputs false sets its nal state to some string s F. Now we wish to check when B outputs F and thus to our circuit we can simply set s c = F. Now we set our Boolean circuit to check to output T if and only if it is the case that i [k 1] (s i+1 is the state of B if the previous state is s i ). In, other words, we construct the circuit that evaluates to true if and only if the s i correspond to the actual states of B starting from s 1. This is where we need to use a formal denition of computation and where our proof only becomes a sketch. We claim that it is possible to write a polynomial size Boolean circuit that is true if and only if s i+1 is the state of B if the previous state is s i and therefore the circuit can be written as just the and of the circuits which check this. The idea is that the algorithm simply applies xed logical rules to go from one state to the next and we can just write down a Boolean formula encapsulating this. This is tedious to do formally, but I believe makes sense intuitively. Consequently, we have constructed a polynomial size circuit that is satisable if and only if there is a sequence of states that correspond to a valid execution of B that go from some input (s, t) to a state corresponding to outputting true. Therefore, by checking if this circuit is satisable we can check if an input string s X in time polynomial in s plus the time to solve circuit-sat once on a problem of size O(poly( s )).

9 CME 305: Discrete Mathematics and Algorithms - Lecture 14 9 This proof should hopefully also convey or suggest why it might seem that NP is harder than the problems we have seen in P. We have essentially shown that NP -complete problems allow us to brute force over the input to polynomial size computation which seems incredibly powerful - though we do not know how to show formally that this is actually more powerful than anything in P.

### Lecture 15 - NP Completeness 1

CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) February 29, 2018 Lecture 15 - NP Completeness 1 In the last lecture we discussed how to provide

### Lecture 8 - Algebraic Methods for Matching 1

CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) February 1, 2018 Lecture 8 - Algebraic Methods for Matching 1 In the last lecture we showed that

### 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

### 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

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

### 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 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

### 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

### Data Structures in Java

Data Structures in Java Lecture 21: Introduction to NP-Completeness 12/9/2015 Daniel Bauer Algorithms and Problem Solving Purpose of algorithms: find solutions to problems. Data Structures provide ways

### /633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18

601.433/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18 20.1 Introduction Definition 20.1.1 We say that an algorithm runs in polynomial time if its running

### Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms

Computer Science 385 Analysis of Algorithms Siena College Spring 2011 Topic Notes: Limitations of Algorithms We conclude with a discussion of the limitations of the power of algorithms. That is, what kinds

### 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

### 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

### 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

### NP, polynomial-time mapping reductions, and NP-completeness

NP, polynomial-time mapping reductions, and NP-completeness In the previous lecture we discussed deterministic time complexity, along with the time-hierarchy theorem, and introduced two complexity classes:

### Notes for Lecture Notes 2

Stanford University CS254: Computational Complexity Notes 2 Luca Trevisan January 11, 2012 Notes for Lecture Notes 2 In this lecture we define NP, we state the P versus NP problem, we prove that its formulation

### 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

### Using DNA to Solve NP-Complete Problems. Richard J. Lipton y. Princeton University. Princeton, NJ 08540

Using DNA to Solve NP-Complete Problems Richard J. Lipton y Princeton University Princeton, NJ 08540 rjl@princeton.edu Abstract: We show how to use DNA experiments to solve the famous \SAT" problem of

### 1 Computational Problems

Stanford University CS254: Computational Complexity Handout 2 Luca Trevisan March 31, 2010 Last revised 4/29/2010 In this lecture we define NP, we state the P versus NP problem, we prove that its formulation

### 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

### 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

### A An Overview of Complexity Theory for the Algorithm Designer

A An Overview of Complexity Theory for the Algorithm Designer A.1 Certificates and the class NP A decision problem is one whose answer is either yes or no. Two examples are: SAT: Given a Boolean formula

### 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

### U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan August 30, Notes for Lecture 1

U.C. Berkeley CS278: Computational Complexity Handout N1 Professor Luca Trevisan August 30, 2004 Notes for Lecture 1 This course assumes CS170, or equivalent, as a prerequisite. We will assume that the

### Friday Four Square! Today at 4:15PM, Outside Gates

P and NP Friday Four Square! Today at 4:15PM, Outside Gates Recap from Last Time Regular Languages DCFLs CFLs Efficiently Decidable Languages R Undecidable Languages Time Complexity A step of a Turing

### 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

### 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

### BBM402-Lecture 11: The Class NP

BBM402-Lecture 11: The Class NP Lecturer: Lale Özkahya Resources for the presentation: http://ocw.mit.edu/courses/electrical-engineering-andcomputer-science/6-045j-automata-computability-andcomplexity-spring-2011/syllabus/

### 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

### 1.1 P, NP, and NP-complete

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

### 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

### Lecture 4: NP and computational intractability

Chapter 4 Lecture 4: NP and computational intractability Listen to: Find the longest path, Daniel Barret What do we do today: polynomial time reduction NP, co-np and NP complete problems some examples

### Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Complexity Theory Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 15 May, 2018 Reinhard

### Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität

Advanced topic: Space complexity CSCI 3130 Formal Languages and Automata Theory Siu On CHAN Chinese University of Hong Kong Fall 2016 1/28 Review: time complexity We have looked at how long it takes to

### 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

### CSC 5170: Theory of Computational Complexity Lecture 9 The Chinese University of Hong Kong 15 March 2010

CSC 5170: Theory of Computational Complexity Lecture 9 The Chinese University of Hong Kong 15 March 2010 We now embark on a study of computational classes that are more general than NP. As these classes

### UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 22 Lecturer: David Wagner April 24, Notes 22 for CS 170

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 22 Lecturer: David Wagner April 24, 2003 Notes 22 for CS 170 1 NP-completeness of Circuit-SAT We will prove that the circuit satisfiability

### 1 Computational problems

80240233: Computational Complexity Lecture 1 ITCS, Tsinghua Univesity, Fall 2007 9 October 2007 Instructor: Andrej Bogdanov Notes by: Andrej Bogdanov The aim of computational complexity theory is to study

### 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

### DD2446 Complexity Theory: Problem Set 4

DD2446 Complexity Theory: Problem Set 4 Due: Friday November 8, 2013, at 23:59. Submit your solutions as a PDF le by e-mail to jakobn at kth dot se with the subject line Problem set 4: your full name.

### Computability and Complexity Theory: An Introduction

Computability and Complexity Theory: An Introduction meena@imsc.res.in http://www.imsc.res.in/ meena IMI-IISc, 20 July 2006 p. 1 Understanding Computation Kinds of questions we seek answers to: Is a given

### Computer Sciences Department

Computer Sciences Department 1 Reference Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Computer Sciences Department 3 ADVANCED TOPICS IN C O M P U T A B I L I T Y

### 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

### CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT

CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT Definition: A language B is NP-complete if: 1. B NP 2. Every A in NP is poly-time reducible to B That is, A P B When this is true, we say B is NP-hard On

### Lecture 4 : Quest for Structure in Counting Problems

CS6840: Advanced Complexity Theory Jan 10, 2012 Lecture 4 : Quest for Structure in Counting Problems Lecturer: Jayalal Sarma M.N. Scribe: Dinesh K. Theme: Between P and PSPACE. Lecture Plan:Counting problems

### 1 Primals and Duals: Zero Sum Games

CS 124 Section #11 Zero Sum Games; NP Completeness 4/15/17 1 Primals and Duals: Zero Sum Games We can represent various situations of conflict in life in terms of matrix games. For example, the game shown

### On the Computational Hardness of Graph Coloring

On the Computational Hardness of Graph Coloring Steven Rutherford June 3, 2011 Contents 1 Introduction 2 2 Turing Machine 2 3 Complexity Classes 3 4 Polynomial Time (P) 4 4.1 COLORED-GRAPH...........................

### NP-complete problems. CSE 101: Design and Analysis of Algorithms Lecture 20

NP-complete problems CSE 101: Design and Analysis of Algorithms Lecture 20 CSE 101: Design and analysis of algorithms NP-complete problems Reading: Chapter 8 Homework 7 is due today, 11:59 PM Tomorrow

### 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

### Intro to Theory of Computation

Intro to Theory of Computation LECTURE 25 Last time Class NP Today Polynomial-time reductions Adam Smith; Sofya Raskhodnikova 4/18/2016 L25.1 The classes P and NP P is the class of languages decidable

### NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

Lecture 19 NP-Completeness I 19.1 Overview In the past few lectures we have looked at increasingly more expressive problems that we were able to solve using efficient algorithms. In this lecture we introduce

### Lecture 20: conp and Friends, Oracles in Complexity Theory

6.045 Lecture 20: conp and Friends, Oracles in Complexity Theory 1 Definition: conp = { L L NP } What does a conp computation look like? In NP algorithms, we can use a guess instruction in pseudocode:

### Tractability. Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time?

Tractability Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time?» Standard working definition: polynomial time» On an input

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

### NP Completeness and Approximation Algorithms

Chapter 10 NP Completeness and Approximation Algorithms Let C() be a class of problems defined by some property. We are interested in characterizing the hardest problems in the class, so that if we can

### 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

### 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)

### 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

### CSCI3390-Lecture 14: The class NP

CSCI3390-Lecture 14: The class NP 1 Problems and Witnesses All of the decision problems described below have the form: Is there a solution to X? where X is the given problem instance. If the instance is

### 2 P vs. NP and Diagonalization

2 P vs NP and Diagonalization CS 6810 Theory of Computing, Fall 2012 Instructor: David Steurer (sc2392) Date: 08/28/2012 In this lecture, we cover the following topics: 1 3SAT is NP hard; 2 Time hierarchies;

### Computational Complexity

p. 1/24 Computational Complexity The most sharp distinction in the theory of computation is between computable and noncomputable functions; that is, between possible and impossible. From the example of

### 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

### 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

### Algorithm Design and Analysis

Algorithm Design and Analysis LECTURE 26 Computational Intractability Polynomial Time Reductions Sofya Raskhodnikova S. Raskhodnikova; based on slides by A. Smith and K. Wayne L26.1 What algorithms are

### 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

### CS 350 Algorithms and Complexity

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

### 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

### The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine.

The Class NP NP is the problems that can be solved in polynomial time by a nondeterministic machine. NP The time taken by nondeterministic TM is the length of the longest branch. The collection of all

### Complexity and NP-completeness

Lecture 17 Complexity and NP-completeness Supplemental reading in CLRS: Chapter 34 As an engineer or computer scientist, it is important not only to be able to solve problems, but also to know which problems

### Class Note #20. In today s class, the following four concepts were introduced: decision

Class Note #20 Date: 03/29/2006 [Overall Information] In today s class, the following four concepts were introduced: decision version of a problem, formal language, P and NP. We also discussed the relationship

### 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

### COMPUTATIONAL COMPLEXITY

ATHEATICS: CONCEPTS, AND FOUNDATIONS Vol. III - Computational Complexity - Osamu Watanabe COPUTATIONAL COPLEXITY Osamu Watanabe Tokyo Institute of Technology, Tokyo, Japan Keywords: {deterministic, randomized,

### The Complexity of Maximum. Matroid-Greedoid Intersection and. Weighted Greedoid Maximization

Department of Computer Science Series of Publications C Report C-2004-2 The Complexity of Maximum Matroid-Greedoid Intersection and Weighted Greedoid Maximization Taneli Mielikäinen Esko Ukkonen University

### CS 5114: Theory of Algorithms. Tractable Problems. Tractable Problems (cont) Decision Problems. Clifford A. Shaffer. Spring 2014

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

### ITCS:CCT09 : Computational Complexity Theory Apr 8, Lecture 7

ITCS:CCT09 : Computational Complexity Theory Apr 8, 2009 Lecturer: Jayalal Sarma M.N. Lecture 7 Scribe: Shiteng Chen In this lecture, we will discuss one of the basic concepts in complexity theory; namely

### 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

### Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes

Complexity Theory 1 Complexity Theory 2 Complexity Theory Lecture 3 Complexity For any function f : IN IN, we say that a language L is in TIME(f(n)) if there is a machine M = (Q, Σ, s, δ), such that: L

### 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

### Introduction to Complexity Theory. Bernhard Häupler. May 2, 2006

Introduction to Complexity Theory Bernhard Häupler May 2, 2006 Abstract This paper is a short repetition of the basic topics in complexity theory. It is not intended to be a complete step by step introduction

### 6.080 / Great Ideas in Theoretical Computer Science Spring 2008

MIT OpenCourseWare http://ocw.mit.edu 6.080 / 6.089 Great Ideas in Theoretical Computer Science Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

### 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

### Notes on Complexity Theory Last updated: December, Lecture 2

Notes on Complexity Theory Last updated: December, 2011 Jonathan Katz Lecture 2 1 Review The running time of a Turing machine M on input x is the number of steps M takes before it halts. Machine M is said

### 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

### Great Theoretical Ideas in Computer Science. Lecture 9: Introduction to Computational Complexity

15-251 Great Theoretical Ideas in Computer Science Lecture 9: Introduction to Computational Complexity February 14th, 2017 Poll What is the running time of this algorithm? Choose the tightest bound. def

### 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

### In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size.

10 2.2. CLASSES OF COMPUTATIONAL COMPLEXITY An optimization problem is defined as a class of similar problems with different input parameters. Each individual case with fixed parameter values is called

### 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

### Computability and Complexity

Computability and Complexity Complexity and Turing Machines. P vs NP Problem CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca

### 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]

### Complexity Theory Part I

Complexity Theory Part I Problem Problem Set Set 77 due due right right now now using using a late late period period The Limits of Computability EQ TM EQ TM co-re R RE L D ADD L D HALT A TM HALT A TM

### Abstract. This paper discusses polynomial-time reductions from Hamiltonian Circuit (HC),

SAT-Variable Complexity of Hard Combinatorial Problems Kazuo Iwama and Shuichi Miyazaki Department of Computer Science and Communication Engineering Kyushu University, Hakozaki, Higashi-ku, Fukuoka 812,

### 1 Reductions and Expressiveness

15-451/651: Design & Analysis of Algorithms November 3, 2015 Lecture #17 last changed: October 30, 2015 In the past few lectures we have looked at increasingly more expressive problems solvable using efficient

### CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/ Logistics HW7 due tonight Thursday's class: REVIEW Final exam on Thursday Dec 8, 8am-11am, LEDDN AUD Note card allowed

### 34.1 Polynomial time. Abstract problems

< Day Day Up > 34.1 Polynomial time We begin our study of NP-completeness by formalizing our notion of polynomial-time solvable problems. These problems are generally regarded as tractable, but for philosophical,

### 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

### 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