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

Size: px
Start display at page:

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

Transcription

1 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 is O(n k ) for some constant k. Is this always the case? Obviously no (just consider basic FF algorithm: running time depends on f ). Some problems are even insolvable, regardless of how much time is provided, e.g., the famous halting problem: It is not possible to tell, in general, whether a given algorithm will halt for some given input. Also, there are problems that are solvable, but not in time O(n k ) for any constant k (they may require strictly exponential time, or even more). P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k. NP is the class of problems for which there are algorithms that verify solutions in time O(n k ) for some constant k. Intuitively, solving harder that merely verifying, so maybe problems in NP-P harder than problems in P.... but... is there something in NP-P????!? One of the most famous question in TCS: P = NP or P 6= NP? Complexity 1 Complexity 2 Obviously, P NP. Back to this verification business. Study NP-complete problems. They are in NP, and, in a sense, they are hard among all problems in NP (or, as hard as any other); will be formalised later. Example Hamiltonian cycle. As mentioned, NP-complete, so apparently hard, perhaps no polynomial-time algorithm that can compute a solution (for all instances). Will prove later: if one can show for only one NP-complete problem that it is in fact in P, then P = NP. Seems to be difficult, so far nobody has succeeded ;-) Sometimes slight modifications to some problem make a huge difference. But: verifying a solution/certificate is trivial! Certificate is sequence (v 1,v 2 m...,v V ) (some ordering of vertices), just have to check whether it s a proper cycle. Euler tour vs Hamiltonian cycle. Euler tour: does given directed graph have a cycle that traverses each edge exactly once? Easy, O(E). Hamiltonian cycle: does given directed graph have a simple cycle that contains each vertex? NPcomplete! Techniques for proving NP-completeness differ from usual techniques for designing or analysing algorithms. In the following, a few key concepts. Complexity 3 Complexity 4

2 1) Decision problems vs optimisation problems Many problems are optimisation problems: compute shortest paths, maximum matching, maximum clique, maximum independent set, etc. Concept of NP-completeness does not apply (directly) to those, but to decision problems, where answer is just yes or no Does this given graph have a Hamiltonian cycle? Given this graph, two vertices, and some k, does G contain a path of length at most k from u to v? However, usually close relationship. In a sense, decision is easier than optimisation (or not harder). Example: can solve SP decision problem by solving SP optimisation: just compare length of (computed) shortest path with k. General idea: evidence that decision problem is hard implies evidence, that related optimisation problem is hard. Complexity 5 2) Encodings When we want an algorithm to solve some problem, problem instances must be encoded. For instance, encode natural numbers as strings {0, 1, 10, 11, 100, 101,...} encoding e : IN! {0, 1} with e(i) =(i) 2 Concrete problem: problem whose instance set is the set of binary strings (read: encodings of real instances) We say an alg. solves some concrete decision problem in time O(T (n)) if, when given problem instance i of length n = i, it can produce solution in time O(T (n)). A concrete problem is poly-time solvable, if there is an alg. to solve it in time O(n k ) for some constant k. P is the set of all poly-time solvable concrete decision problems. Complexity 6 Would like to talk about abstract problems rather than concrete ones, independent of any particular encoding. But... efficiency depends heavily on encoding. Example: suppose integer k is input to an alg., running time is (k). If k is given in unary, then then running time is O(n) in length-n inputs, polynomial. If k is given binary, then input length is n = blog kc +1; exponential running time (k) = (2 n ). In practice, rule out expensive encodings like unary. A formal-language framework An alphabet is finite set of sysmbols. A language L over is any set of strings made up of symbols from. Empty string is, empty language is ;. Language of all strings over is Ex: = {0, 1} ) = {, 0, 1, 00, 01, 10, 11, 000,...}, all binary strings. Every language L over is subset of. Union L 1 [L 2 and intersection L1\L 2 just like with ordinary sets, complement L = L. Concatenation of L 1 and L 2 is {xy : x 2 L 1,y 2 L 2 }. Closure of L is { } [ L [ L 2 [ L 3 [ with L k being L concatenated to itself k times. Complexity 7 Complexity 8

3 Set of instances for any decision problem Q is, where = {0, 1}. Encoding: Using formal languages is fine Q is entirely characterised by those instances that produce 1 (yes), so we view Q as language L over = {0, 1} with L = {x 2 : Q(x) =1} Ex: (<something> meaning standard enc. of something) HAMILTON = {< G >: G contains Hamiltonian cycle} SAT = {< F >: formula F is satisfyable} We say function f : {0, 1}! {0, 1} is polynomially computable if there is polynomial-time TM M that, given x 2 {0, 1}, computes f(x). For set I of problem instances, two encodings e 1 and e 2 are polynomially related if there are two poly-time computable functions f 12 and f 21 such that 8i 2 I, f 12 (e 1 (i)) = e 2 (i) and f 21 (e 2 (i)) = e 1 (i) If two encodings of some abtract problem are polynomially related, then whether problem is in P is independent of which encoding we use. Note: the length can increase only by a polynomial factor! It can be shown: the standard inputs (graph as an adjacency matrix,...) are polynomially related. Complexity 9 Complexity 10 Lemma. Let Q be an abstract decision problem on an instance set I, let e 1,e 2, be polynomially related encodings on I. Then, e 1 (Q) 2 P iff e 2 (Q) 2 P. Proof. We show one direction (e 1 (Q) 2 P ) e 2 (Q) 2 P), other is symmetric. Suppose e 1 (Q) 2 P, i.e., e 1 (Q) can be solved in time O(n k ) for some constant k, and that for any instance i, e 1 (i) can be computed from e 2 (i) in time O(n c ) for some constant c, n = e 2 (i). To solve e 2 (Q), on input e 2 (i), first compute e 1 (i), and run alg. for e 1 (Q) on e 1 (i). Time: conversion takes O(n c ), therefore e 1 (i) = O(n c ) (can t write more). Solving e 1 (i) takes O( e 1 (i) k )=O(n ck ), polynomial. Thus e 2 (Q) 2 P. 3) Machine Model Our goal is to say that Problem A can not be solved in polynomial time. But on which machine? A parallel machine with 1000 processors? A modern computer? Can we solve more in polynomial time if the computers get faster? In complecity theory people use a very simple machine model, the so-called Turing machine. One can show that everything that can be solved by a modern computer in polynomial time can also be solved on a TM in polynomial time. Complexity 11 Complexity 12

4 Machine Model A TM (Turing machine) consists of a tape of infinite length (in one direction) and a pointer. The tape consists of cells and every cell can store one symbol. Formally, a Turing Machine M =(Q,, Q is the (finite) set of states.,,q 0,B,F) is defined as follows. The pointer points to one of the memory cells. In the beginning the input is in cell 1,...and the pointer position is cell 1. is the set of tape symbols. is the set of input symbols ( ). The TM has a finite control. In every step the control is in one of a finite amount of states. In every step the TM does the following. It reads the symbol at the actual pointer position B = {N, R, L}. :(Q )! (Q {L, R, N} is the transition function. q 0 2 Q is the initial state. F Q is an end state. It writes a new symbol into the position (which one depends on the state) It can move the pointer one step to the left or to the right. Complexity 13 Complexity 14 State of the TM: 1 q 2 with q 2 Q and 1, 2 2. here = 1 2 is the contents of the tape. The language L accepted by TM M is the set of words from so that M reaches a state in F. To make our life easier we will say in the following that M outputs 1. If now 2 = 0 2 the TM looks up (q, ) =(q0, If M = N the next state will be 1 q If M = R the next state will be 1 q ,M). In all other cases M rejects in input. It can stop in a state not in F and output 0, or M can go into an endless loop. If M = R and 1 = 0 1 the next state will be 1q We write 1 q 2 ) 0 1 q0 0 2 if a one step transition from 1q 2 to 0 1 q0 0 2 exists. We write 1 q 2 ) 0 1 q0 0 2 if a (possibly long) transition from 1q 2 to 0 1 q0 0 2 exists. Examples for TM: see homework. Complexity 15 Complexity 16

5 We say TM M accepts string x 2 {0, 1} if, given input x, M s output is M(x) = 1. The language accepted by M is L = {x 2 : M(x) =1}. Moreover: Theorem. P = {L : L is accepted by a TM in poly-time}. Proof. Clearly decided)accepted, so we need only show accepted)decided. M rejects x if M(x) =0. Important: even if L is accepted by some TM M, M will not necessarily reject x 62 L. A language L is decided by TM M, if L is accepted by M and every string not in L is rejected. L is accepted/decided in polynomial time by TM M, if it is accepted/decided by M in time O(n k ) for some const. k. Let L be accepted by M in time O(n k ), thus there is constant c s.t. M accepts L in at most T = cn k steps. Construct M 0 : for any input string x, M 0 simulates M for T steps. If M has accepted, then M 0 accepts x by outputting 1, otherwise M 0 rejects by outputting 0 q.e.d. Note: proof is nonconstructive, we may not know runtime bound for given L 2 P (but it exists!). Now: alternative definition P = {L {0, 1} : 9 TM M that decides L in poly-time} Complexity 17 Complexity 18 Poly-time verification Look at TMs that verify membership in languages. Ex: for instance <G>of HAMILTON, we are also given ordering c of vertices on cycle. Can easily check whether c is a proper cycle on all vertices of G, so c is certificate that G indeed belongs to HAMILTON. As we will see later, HAMILTON is NP-complete, and thus most likely not in P, but verification is easy. Define verification TM: two argument TM M, one argument is ordinary input string x, other is binary string y called certificate. M verifies input string x if 9 certificate y s.t. M(x, y) =1. The language verified by M is L = {x 2 {0, 1} : 9y 2 {0, 1} s.t. M(x, y) =1} Intuition: M verifies L if 8x 2 L there is y that M can use to prove x 2 L. For any x 62 L, there must be no certificate proving that x 2 L. Ex: If G 62 HAMILTON there must be no permutation of vertices that can fool verifier into believing G is hamiltonian. Def: a language L belongs to NP if and only if 9 two-input poly-time TM M and constant c s.t. L = {x 2 {0, 1} : 9 certificate y with y = O( x c ) such that M(x, y) =1} Historically, NP= non-deterministic poly-time, all the problems that are accepted by a poly-time non-deterministic Turing machine (NTM), which 1. non-deterministically guesses a solution (certificate) if there is one, and 2. deterministically verifies it in poly-time. See the similarity? Facts: NP 6= ; (HAMILTON2 NP) P NP Complexity 19 Complexity 20

6 Open questions: NP-completeness P = NP or P 6= NP? NP closed under complement, i.e., L 2 NP ) L 2 NP? (with co-np = {L : L 2 NP}, equiv. to NP = co-np) Since P is closed under complement, P NP\ co-np. Thus four possibilities: Remember: class of NP-complete problems; property: if one of them is in P, then all of NP. Reducibility P = NP = co NP P NP = co NP Intuition: problem Q can be reduced to Q 0 if any instance of Q can be easily rephrased as instance of Q 0 co NP P = NP co NP NP co NP P = NP P co NP NP We say that language L 1 is poly-time reducible to language L 2, written L 1 apple p L 2, if there exists a poly-time computable function f : {0, 1}! {0, 1} s.t. 8x 2 {0, 1}, TL: NP = co-np and P = NP, most unlikely of the four TR: NP = co-np and P 6= NP BL: NP 6= co-np and P = NP \ co-np BR: NP 6= co-np and P 6= NP \ co-np, most likely Complexity 21 f is called reduction function. x 2 L 1 if and only if f(x) 2 L 2. Complexity 22 NP-completeness II Idea of poly-time reduction from L 1 to L 2 : A language L {0, 1} is called NP-complete if 1. L 2 NP, and 2. L 0 apple p L for every L 0 2 NP. If L satisfies only (2) it is called NP-hard. L 1,L 2 {0, 1} f provides poly-time mapping s.t. if x 2 L 1 then f(x) 2 L 2 if x 62 L 1 then f(x) 62 L 2 Thus f maps any instance x of decision problem represented by L 1 to instance f(x) of problem represented by L 2 Answer to whether f(x) 2 L 2 directly provides answer to whether x 2 L 1 Complexity 23

7 {0,1}* {0,1}* f Proving that some language is in P is easy now: L1 L2 Lemma. If L 1,L 2 {0, 1} with L 1 apple p L 2, then L 2 2 P implies L 1 2 P. Proof. Let M 2 be poly-time TM that decides L 2, let F be poly-time TM that computes reduction function f. Construction of poly-time TM M 1 that decides L 1 : x F f(x) A2 yes, f(x) in L2 yes, x in L1 A1 no, f(x) not in L2 no, x not in L1 Complexity 24 Complexity 25 The set of NP-complete languages is called NPC. Most people believe P 6= NP, thus NP-completeness may helpful for showing P = NP or P 6= NP: Theorem. (i) If any NP-complete problem is in P, then P = NP. Equivalently, (ii) if any problem in NP is not in P, then no NP-complete problem is in P. NP P NPC Proof. (i) Suppose L 2 P and L 2 NPC. For any L 0 2 NP, we have L 0 apple p L by definition of NP-completeness. By last lemma, L 0 2 P, and thus NP = P. (ii) is contrapositive of (i) [a la (A ) B) () ( B ) A)] Anyways, how does one prove NP-completeness of some particular problem? Two ways... By hand (master reduction), show that L 2 NP (easy part) and L 0 apple p L for every L 0 2 P (hard part). Most famous (and first): Cook s proof that SAT2 NPC. or (usually significantly) easier, given that you already know some other problem to be NP-complete: Complexity 26 Complexity 27

8 A helpful lemma: Lemma. (Transitivity) apple p is a transitive relation on languages, i.e., if L 1 apple p L 2 and L 2 apple p L 3, then L 1 apple p L 3. Proof. By definition, there are poly-time functions f and g such that x 2 L 1, f(x) 2 L 2 and y 2 L 2, g(y) 2 L 3, thus x 2 L 1, f(x) 2 L 2, g(f(x)) 2 L 3. Obviously, g(f( )) is poly-time (since f(x) is polynomial in x ). Theorem. If L is a language s.t. L 0 apple p L for some L 0 2 NPC, then L is NPhard. Moreover, if L 2 NP, then L 2 NPC. Proof. L 0 is NP-complete, thus we have L 00 apple p L 0 for all L 00 2 NP. With L 0 apple p L and by transitivity (last lemma) we have L 00 apple p L, so L is NP-hard. If L 2 NP, we have L 2 NPC by definition. NP L L Method for proving that L 2 NPC: prove L 2 NP select known NP-complete L 0 describe alg. F that computes f mapping every instance x 2 {0, 1} of L 0 to instance f(x) of L prove that f satisfies x 2 L 0, f(x) 2 L 8x 2 {0, 1} prove that F runs in poly time Complexity 28 Complexity 29 Formula satisfiability Was first problem to be proven NP-complete. A formula with a satisfying t.a. is called satisfiable. SAT = {< F >: F is a satisfiable boolean formula}. Among most popular problems for reductions. Definition in terms of language SAT. An instance of SAT is a boolean formula F composed of 1. n boolean variables x 1,x 2,...,x n 2. m boolean operators; any boolean function with one or two inputs and one output, such as ^ (AND), _ (OR), (NOT),! (implication), $ (if and only if) 3. parenthesis (WLOG assume no redundant parenthesis) Easy to encode F in length polynomial in n + m. A truth assignment for F is set of values for the variables. A satisfying truth assignment is a t.a. that causes it to evaluate to 1. Complexity 30

9 Example Thus F 2 SAT. F =((x 1! x 2 ) _ (( x 1 $ x 3 ) _ x 4 )) ^ x 2 has satisfying assignment x 1 =0,x 2 =0,x 3 =1,x 4 =1 F = ((0! 0) _ (( 0 $ 1) _ 1)) ^ 0 = (1_ ((1 $ 1) _ 1)) ^ 1 = (1_ (1 _ 1)) ^ 1 = (1_ 1) ^ 1 = 1^ 1 = 1 Note: a b a! b a b a $ b Complexity 31 Theorem. SAT is NP-complete. Proof. (i) SAT 2 NP. Easy, replace each variable with corresponding value, evaluate. Polynomial time. (ii) SAT is NP-hard, i.e., L apple p SAT for all L 2 NP. Not quite so easy, proof not shown. Now: could use SAT to show NP-completeness of other languages. First, consider CNF-SAT and 3-CNF-SAT. A literal is an occurrence of variable (x i ) or its negation ( x i ). A boolean formula is in conjunctive normal form (CNF) if it is an AND of clauses, each of which is OR of literals. Ex: (x 1 _ x 2 _ x 3 ) ^ (x {z } 2 _ x 4 ) ^ (x {z } 2 _ x 3 _ x 4 _ x 5 ) {z } clause clause clause A formula is in 3CNF if each clause contains exactly three, distinct literals. Complexity 32 CNF-SAT = {< F >: F is in CNF and is satisfiable} 3-CNF-SAT = {< F >: F is in 3CNF and is satisfiable} Theorem. CNF-SAT is NP-complete. Proof. Obviously in NP (since SAT 2 NP). NP-hardness can be shown e.g. by reduction from SAT, i.e., SAT apple p CNF-SAT. Proof not shown. Theorem. 3-CNF-SAT is NP-complete. Proof. Obviously in NP (since SAT 2 NP and CNF-SAT 2 NP). NP-hardness by reduction from CNF-SAT. Let F = F 1 ^ F 2 ^ ^ F k be a CNF formula. Suppose clause F i has more than three literals e.g. F i = 1 _ 2 _ _ ` with ` > 3

10 Note: are literals rather than variables. Introduce new variables y 1,y 2,...,y` 3 and replace F i with We want to construct new clauses with exactly three literals each, but same satisfiability property. Fi 0 = ( 1 _ 2 _ y 1 ) ^ ( 3 _ y 1 _ y 2 ) ^ ( 4 _ y 2 _ y 3 ) ^ ^ ( ` 2 _ y` 4 _ y` 3 ) ^ ( ` 1 _ ` _ y` 3 ) Now, an assignment satisfies F i if and only if it (rather, an extension) satisfies F 0 i. ) Suppose F i is satisfied by some assignment. Must be that j =1for some j. Suppose 1 = = j 1 =0and j =1. Then and y 1 = = y j 2 =1 y j 1 = = y` 3 =0 is an extension of the original assignment that satisfies F 0 i (all new clauses in F 0 i are satisfied). Complexity 33 Complexity 34 ( Suppose some assignment satisfies F 0 i. Need to show that for F i, 9j with j =1 when restricting to assignment for s. Suppose that s not true, i.e. i =0for i =1,...,`. Then, by construction, must be that y 1 =1(1st clause). Also, since y 1 =1, y 1 =0, must be that y 2 =1(2nd clause). By induction, must be that y m =18m 2 {1,...,` 3}. What about size 1&2 clauses? ( 1 )! ( 1 _ y 1 _ y 2 ) ^ ( 1 _ y 1 _ y 2 ) ^ ( 1 _ y 1 _ y 2 ) ^ ( 1 _ y 1 _ y 2 )^ If LHS satisfied, then obviously also RHS. Suppose RHS satisfied but 1 =0. Then in each of the four RHS-clauses the y s must take care of the business. But: impossible! But wait, hang on, don t move! Last clause in Fi 0 would be 0, <blink> contradiction! </blink> Similar reasoning. ( 1 _ 2 )! ( 1 _ 2 _ y) ^ ( 1 _ 2 _ y) Size of formula remains polynomial in what it was. Conclusion: each assignm. that satisfies F 0 i also satisfies F i. Time also polynomial. (q.e.d.) Complexity 35 Complexity 36

11 Another NP-complete problem: CLIQUE A clique in an undirected graph G =(V,E) is subset V 0 V, each pair of which is connected by an edge in E, i.e., a complete subgraph. A k-clique is a clique of size k. Optimisation problem: given G, find a clique of maximum size. Decision problem: given G and k 2 IN, does G contain k-clique? CLIQUE = {< G,k>: G is a graph with a k-clique} Naive solution: list all k-subsets, check each one. Running time is k 2 V k (time for checking # of k-subsets). Polynomial if k constant, but super-polynomial if e.g. k V /2. Complexity 37 Theorem. CLIQUE is NP-complete. Proof. To show CLIQUE 2 NP, use V 0 V as certificate. Just check whether (u, v) 2 E for all u, v 2 V 0. Now we show 3-CNF-SAT apple p CLIQUE. Given instance F = C 1 ^ C 2 ^ ^ C k in 3CNF. Each clause C i contains three distinct literals i 1, i 2, i 3. Shall construct G s.t. G contains k-clique if and only if F is satisfiable. For each clause C r =( r 1 _ r 2 _ r 3 ) we place triple of vertices vr 1,vr 2,vr 3 into V. Edge between v r i and vs j if 1. vi r and vs j are in different triples, i.e., r 6= s, and 2. their corresponding literals are consistent: r i is not the negation of s j Complexity 38 Ex: F =(x 1 _ x 2 _ x 3 ) ^ ( x 1 _ x 2 _ x 3 ) ^ (x 1 _ x 2 _ x 3 ) becomes 1st clause $x_1$ $\neg x_2$$\neg x_3$ 2nd clause $\neg x_1$ $x_2$ $x_3$ $x_1$ $x_2$ $x_3$ Obviously, construction possible in polynomial time. Complexity 39 3rd clause ) Suppose F has a satisfying assignment. Then each clause C r contains 1 literal r i =1. Picking one such true literal from each clause corresponds to picking k vertices in G, yielding V 0. Claim: V 0 is a k-clique. For any v r i,vs j 2 V 0, r 6= s, both corresponding literals are true, so cannot be complements. Thus, edge (v r i,vs j ) 2 E. ( Suppose G has k-clique V 0. No inner-triple edges, thus exactly one vertex per triple in V 0. No edges between vertices corresponding to inconsistent literals. Thus, we can assign 1 to each literal r i s.t. vr i 2 V 0. One true literal per clause, thus F satisfied. (q.e.d.) Complexity 40

12 Yet another example: INDEPENDENT-SET An independent set (IS) in an undirected graph G = (V,E) is subset V 0 V, each pair of which is not connected by an edge in E, i.e., an edge-less subgraph. A k-is is an independent set of size k. Why superpolynomial? Let n = V, then k 2 V = (n/2)2 n k n/2 = (n 2 n! /4) (n/2)! (n = (n 2 n! /4) ((n/2)!) 2 n/2)! Optimisation problem: given G, find an IS of maximum size. Decision problem: given G and k 2 IN, does G contain a k-is? INDEPENDENT-SET = {< G,k>: G is a graph with a k-is} Naive solution: list all k-subsets, check each one. Running time is k 2 V k (time for checking # of k-subsets). Polynomial if k constant, but super-polynomial if e.g. k V /2. By Stirling s famous formula x! p 2 x (x/e) x, p k 2 V (n 2 2 n (n/e) n /4) k q2 (n/2) (n/2e) (n/2) 2 p = (n 2 2 n (n/e) n /4) 2 (n/2) (n/2e) p n = (n 2 2 n /4) 2 (n/2) 2n = (n 2 /4) 2p 2 n 2 n 2n =(n 2 2 /4) p 2 n 2 n 2n 2 = 4 p 2 pn 2n = n3/2 2 p 2 2n = (2 n ) Complexity 41 Theorem. INDEPENDENT-SET is NP-complete. Proof. To show INDEPENDENT-SET 2 NP, use V 0 V as certificate. Just check whether (u, v) 62 E for all u, v 2 V 0. Now we show CLIQUE apple p INDEPENDENT-SET. Given instance (G, k). Construct G 0 =(V,E 0 ) with E 0 = V V {(v, v) : v 2 V } {z } self-loops E Claim: G contains k-clique if and only if G 0 contains k-is. Trivially true, since a clique is a subset of vertices with an edge between any pair of vertices, and an IS is a subset of vertices without an edge between any pair of vertices. Construction clearly in P thus... (q.e.d.) Complexity 43

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

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

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

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

Review of unsolvability

Review of unsolvability Review of unsolvability L L H To prove unsolvability: show a reduction. To prove solvability: show an algorithm. Unsolvable problems (main insight) Turing machine (algorithm) properties Pattern matching

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

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

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

34.1 Polynomial time. Abstract problems

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,

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

Lecture 25: Cook s Theorem (1997) Steven Skiena. skiena

Lecture 25: Cook s Theorem (1997) Steven Skiena.   skiena Lecture 25: Cook s Theorem (1997) Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Prove that Hamiltonian Path is NP

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

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

CS154, Lecture 13: P vs NP

CS154, Lecture 13: P vs NP CS154, Lecture 13: P vs NP The EXTENDED Church-Turing Thesis Everyone s Intuitive Notion of Efficient Algorithms Polynomial-Time Turing Machines More generally: TM can simulate every reasonable model of

More information

NP-Complete Problems. Complexity Class P. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar..

NP-Complete Problems. Complexity Class P. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar.. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar.. Complexity Class P NP-Complete Problems Abstract Problems. An abstract problem Q is a binary relation on sets I of input instances

More information

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem.

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem. 1 More on NP In this set of lecture notes, we examine the class NP in more detail. We give a characterization of NP which justifies the guess and verify paradigm, and study the complexity of solving search

More information

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch 6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch Today: More Complexity Theory Polynomial-time reducibility, NP-completeness, and the Satisfiability (SAT) problem Topics: Introduction

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

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

CSE 135: Introduction to Theory of Computation NP-completeness

CSE 135: Introduction to Theory of Computation NP-completeness CSE 135: Introduction to Theory of Computation NP-completeness Sungjin Im University of California, Merced 04-15-2014 Significance of the question if P? NP Perhaps you have heard of (some of) the following

More information

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

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

More information

CS154, Lecture 13: P vs NP

CS154, Lecture 13: P vs NP CS154, Lecture 13: P vs NP The EXTENDED Church-Turing Thesis Everyone s Intuitive Notion of Efficient Algorithms Polynomial-Time Turing Machines More generally: TM can simulate every reasonable model of

More information

NP-Completeness. ch34 Hewett. Problem. Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g.

NP-Completeness. ch34 Hewett. Problem. Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g. NP-Completeness ch34 Hewett Problem Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g., O(2 n ) computationally feasible poly-time alg. sol. E.g., O(n k ) No

More information

Lecture 16: Time Complexity and P vs NP

Lecture 16: Time Complexity and P vs NP 6.045 Lecture 16: Time Complexity and P vs NP 1 Time-Bounded Complexity Classes Definition: TIME(t(n)) = { L there is a Turing machine M with time complexity O(t(n)) so that L = L(M) } = { L L is a language

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

Intro to Theory of Computation

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

More information

CISC 4090 Theory of Computation

CISC 4090 Theory of Computation CISC 4090 Theory of Computation Complexity Professor Daniel Leeds dleeds@fordham.edu JMH 332 Computability Are we guaranteed to get an answer? Complexity How long do we have to wait for an answer? (Ch7)

More information

Finish K-Complexity, Start Time Complexity

Finish K-Complexity, Start Time Complexity 6.045 Finish K-Complexity, Start Time Complexity 1 Kolmogorov Complexity Definition: The shortest description of x, denoted as d(x), is the lexicographically shortest string such that M(w) halts

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

The Cook-Levin Theorem

The Cook-Levin Theorem An Exposition Sandip Sinha Anamay Chaturvedi Indian Institute of Science, Bangalore 14th November 14 Introduction Deciding a Language Let L {0, 1} be a language, and let M be a Turing machine. We say M

More information

Advanced Topics in Theoretical Computer Science

Advanced Topics in Theoretical Computer Science Advanced Topics in Theoretical Computer Science Part 5: Complexity (Part II) 30.01.2014 Viorica Sofronie-Stokkermans Universität Koblenz-Landau e-mail: sofronie@uni-koblenz.de 1 Contents Recall: Turing

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

1 Computational problems

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

More information

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

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

More information

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

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

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

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

Automata Theory CS Complexity Theory I: Polynomial Time

Automata Theory CS Complexity Theory I: Polynomial Time Automata Theory CS411-2015-17 Complexity Theory I: Polynomial Time David Galles Department of Computer Science University of San Francisco 17-0: Tractable vs. Intractable If a problem is recursive, then

More information

Comparison of several polynomial and exponential time complexity functions. Size n

Comparison of several polynomial and exponential time complexity functions. Size n Comparison of several polynomial and exponential time complexity functions Time complexity function n n 2 n 3 n 5 2 n 3 n Size n 10 20 30 40 50 60.00001.00002.00003.00004.00005.00006 second second second

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

Computational Complexity

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

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

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

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

More information

NP-Completeness and Boolean Satisfiability

NP-Completeness and Boolean Satisfiability NP-Completeness and Boolean Satisfiability Mridul Aanjaneya Stanford University August 14, 2012 Mridul Aanjaneya Automata Theory 1/ 49 Time-Bounded Turing Machines A Turing Machine that, given an input

More information

BBM402-Lecture 11: The Class NP

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/

More information

Theory of Computation Time Complexity

Theory of Computation Time Complexity Theory of Computation Time Complexity Bow-Yaw Wang Academia Sinica Spring 2012 Bow-Yaw Wang (Academia Sinica) Time Complexity Spring 2012 1 / 59 Time for Deciding a Language Let us consider A = {0 n 1

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

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

CMPT307: Complexity Classes: P and N P Week 13-1

CMPT307: Complexity Classes: P and N P Week 13-1 CMPT307: Complexity Classes: P and N P Week 13-1 Xian Qiu Simon Fraser University xianq@sfu.ca Strings and Languages an alphabet Σ is a finite set of symbols {0, 1}, {T, F}, {a, b,..., z}, N a string x

More information

CS151 Complexity Theory. Lecture 1 April 3, 2017

CS151 Complexity Theory. Lecture 1 April 3, 2017 CS151 Complexity Theory Lecture 1 April 3, 2017 Complexity Theory Classify problems according to the computational resources required running time storage space parallelism randomness rounds of interaction,

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

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

Chapter 2 : Time complexity

Chapter 2 : Time complexity Dr. Abhijit Das, Chapter 2 : Time complexity In this chapter we study some basic results on the time complexities of computational problems. concentrate our attention mostly on polynomial time complexities,

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

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 I. Lecture Overview Introduction: Reduction and Expressiveness

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

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

Non-emptiness Testing for TMs

Non-emptiness Testing for TMs 180 5. Reducibility The proof of unsolvability of the halting problem is an example of a reduction: a way of converting problem A to problem B in such a way that a solution to problem B can be used to

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

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

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

MTAT Complexity Theory October 13th-14th, Lecture 6

MTAT Complexity Theory October 13th-14th, Lecture 6 MTAT.07.004 Complexity Theory October 13th-14th, 2011 Lecturer: Peeter Laud Lecture 6 Scribe(s): Riivo Talviste 1 Logarithmic memory Turing machines working in logarithmic space become interesting when

More information

1 More finite deterministic automata

1 More finite deterministic automata CS 125 Section #6 Finite automata October 18, 2016 1 More finite deterministic automata Exercise. Consider the following game with two players: Repeatedly flip a coin. On heads, player 1 gets a point.

More information

CSE 105 THEORY OF COMPUTATION

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

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

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

1.1 P, NP, and NP-complete

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

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

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

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

CS154, Lecture 17: conp, Oracles again, Space Complexity

CS154, Lecture 17: conp, Oracles again, Space Complexity CS154, Lecture 17: conp, Oracles again, Space Complexity Definition: conp = { L L NP } What does a conp computation look like? In NP algorithms, we can use a guess instruction in pseudocode: Guess string

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

Lecture 4 : Quest for Structure in Counting Problems

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

More information

Computability and Complexity Theory: An Introduction

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

More information

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

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

More information

Turing Machines and Time Complexity

Turing Machines and Time Complexity Turing Machines and Time Complexity Turing Machines Turing Machines (Infinitely long) Tape of 1 s and 0 s Turing Machines (Infinitely long) Tape of 1 s and 0 s Able to read and write the tape, and move

More information

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

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

More information

CSE200: Computability and complexity Space Complexity

CSE200: Computability and complexity Space Complexity CSE200: Computability and complexity Space Complexity Shachar Lovett January 29, 2018 1 Space complexity We would like to discuss languages that may be determined in sub-linear space. Lets first recall

More information

Lecture Notes 4. Issued 8 March 2018

Lecture Notes 4. Issued 8 March 2018 CM30073 Advanced Algorithms and Complexity 1. Structure of the class NP Lecture Notes 4 Issued 8 March 2018 Recall that it is not known whether or not P = NP, the widely accepted hypothesis being that

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

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY THURSDAY APRIL 3 REVIEW for Midterm TUESDAY April 8 Definition: A Turing Machine is a 7-tuple T = (Q, Σ, Γ, δ, q, q accept, q reject ), where: Q is a

More information

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65 Undecidable Problems Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, 2018 1/ 65 Algorithmically Solvable Problems Let us assume we have a problem P. If there is an algorithm solving

More information

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University NP-Completeness CptS 223 Advanced Data Structures Larry Holder School of Electrical Engineering and Computer Science Washington State University 1 Hard Graph Problems Hard means no known solutions with

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

Algorithm Design and Analysis

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

More information

CS Fall 2011 P and NP Carola Wenk

CS Fall 2011 P and NP Carola Wenk CS3343 -- Fall 2011 P and NP Carola Wenk Slides courtesy of Piotr Indyk with small changes by Carola Wenk 11/29/11 CS 3343 Analysis of Algorithms 1 We have seen so far Algorithms for various problems Running

More information

P and NP. Or, how to make $1,000,000.

P and NP. Or, how to make $1,000,000. P and NP Or, how to make $1,000,000. http://www.claymath.org/millennium-problems/p-vs-np-problem Review: Polynomial time difference between single-tape and multi-tape TMs Exponential time difference between

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

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

TIME COMPLEXITY AND POLYNOMIAL TIME; NON DETERMINISTIC TURING MACHINES AND NP. THURSDAY Mar 20

TIME COMPLEXITY AND POLYNOMIAL TIME; NON DETERMINISTIC TURING MACHINES AND NP. THURSDAY Mar 20 TIME COMPLEXITY AND POLYNOMIAL TIME; NON DETERMINISTIC TURING MACHINES AND NP THURSDAY Mar 20 COMPLEXITY THEORY Studies what can and can t be computed under limited resources such as time, space, etc Today:

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

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete)

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete) CS5371 Theory of Computation Lecture 19: Complexity IV (More on NP, NP-Complete) Objectives More discussion on the class NP Cook-Levin Theorem The Class NP revisited Recall that NP is the class of language

More information

No Harder Than. We want these transformations to effectively be a problem-hardness version of #, which we will call No Harder Than.

No Harder Than. We want these transformations to effectively be a problem-hardness version of #, which we will call No Harder Than. No Harder Than We want these transformations to effectively be a problem-hardness version of #, which we will call No Harder Than. If we can reduce problem B to problem A appropriately, then we say that

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

Computability Theory

Computability Theory CS:4330 Theory of Computation Spring 2018 Computability Theory The class NP Haniel Barbosa Readings for this lecture Chapter 7 of [Sipser 1996], 3rd edition. Section 7.3. Question Why are we unsuccessful

More information

Computational Intractability 2010/4/15. Lecture 2

Computational Intractability 2010/4/15. Lecture 2 Computational Intractability 2010/4/15 Professor: David Avis Lecture 2 Scribe:Naoki Hatta 1 P and NP 1.1 Definition of P and NP Decision problem it requires yes/no answer. Example: X is a set of strings.

More information

CS311 Computational Structures. NP-completeness. Lecture 18. Andrew P. Black Andrew Tolmach. Thursday, 2 December 2010

CS311 Computational Structures. NP-completeness. Lecture 18. Andrew P. Black Andrew Tolmach. Thursday, 2 December 2010 CS311 Computational Structures NP-completeness Lecture 18 Andrew P. Black Andrew Tolmach 1 Some complexity classes P = Decidable in polynomial time on deterministic TM ( tractable ) NP = Decidable in polynomial

More information

Lecture 2 (Notes) 1. The book Computational Complexity: A Modern Approach by Sanjeev Arora and Boaz Barak;

Lecture 2 (Notes) 1. The book Computational Complexity: A Modern Approach by Sanjeev Arora and Boaz Barak; Topics in Theoretical Computer Science February 29, 2016 Lecturer: Ola Svensson Lecture 2 (Notes) Scribes: Ola Svensson Disclaimer: These notes were written for the lecturer only and may contain inconsistent

More information