Applied Computer Science II Chapter 7: Time Complexity. Prof. Dr. Luc De Raedt. Institut für Informatik Albert-Ludwigs Universität Freiburg Germany
|
|
- Lynn Sparks
- 5 years ago
- Views:
Transcription
1 Applied Computer Science II Chapter 7: Time Complexity Prof. Dr. Luc De Raedt Institut für Informati Albert-Ludwigs Universität Freiburg Germany Overview Measuring complexity The class P The class NP NP-completeness Additional NP-complete problems
2 Measuring complexity How much time needed to decide a language A= {0 1 0} Use Machine M1 Measuring complexity Worst-case versus average-case The time complexity of a TM M is the function f : Ν Ν, where f( n) is the max number of steps that M uses on any input of length n. We typically use big-o and small-o notation (cf. ACS I); asymptotic analysis
3 Big-O + Let f, g: Ν R be two functions. We say that f( n) is O( g( n)) if positive integers c and n exist so that for every integer Ogn ( ( )) is an upper bound for f( n) 3 2 ( ) f n = n + n + n+ 3 = ( ) choose = 6 and 0 = 10 f O n c n 4 2 is also ( ) but not ( ) f O n O n f( n) = 3 n.log n+ 5 n.log log n+ 2 f( n) = O( n.log n) n n holds that f( n) cg. ( n) 0 0 p log b x = p if and only if b = x (definition) log x*y = log x + log y b b b log x/y = log x - log y b b b log x = p log x which implies that (x ) = x b p p q (pq) b log x = log x * log a b a b
4 Small-o + Let f, g: Ν R be two functions. We say that f( n) is o( g( n)) if f( n) lim = 0, i.e. for any real number c > 0, n gn ( ) there is a number n where f( n) < cg. ( n) for all n n o 0 Time Complexity Let t : Ν Νbe a function. Define the time complexity class TIME( t( n)) ={ L L is a language decided by an O( t( n)) time Turing machine} 2 So, {0 1 0} TIME( n ) Can we find a machine that decides A assymptotically more quicly? 2 i.e. is A TIME( t( n)) for t( n) = o( n )?
5 Analyzing algorithms Analyzing algorithms 2-tape machine
6 Complexity relationship among models Theorem 7.8 Let tn ( ) be a function where tn ( ) n. Then every tn ( ) time multitape Turing machine has an equivalent Otn 2 ( ( ) ) time single-tape Turing machine. Proof elements Let M be a tape TM that runs in t( n) 2 Construct (single-tape TM) that runs in ( ( ) ) time S 2 ( ( ) ) steps 2 2 ( ) (( )) (( )) when ( ) O t n Analyze simulation To simulate each step of M, S maes two scans over active input tape each of the active parts of the tapes are of length at most t( n) i.e. t. ( n) = O( t( n)) and possibly shifts (for inserting a new cell) shifts tae Otn ( ( )) time First phase : copying inputs from M to S taes On ( ) steps Second phase : simulate the tn ( ) steps of M taes tnotn ( ). ( ( )) = Otn On + Otn = Otn tn n
7 Definition Let N be an NTM that is a decider. The running time of Nis the function f : Ν Ν, where f( n) is the maximum number of steps that N uses on any branch of its computation of any input of length n as shown below Definition 7.9 including figure 7.1 Theorem 7.10 Let tn ( ) be a function where tn ( ) n. Then every tn ( ) time nondeterministic Turing machine has an equivalent 2 Otn (( )) time deterministic single-tape Turing machine.
8 Proof elements Every branch of N has length at most t( n)for input of length n Every node in tree has at most b children (determined by δ ) Exploration tree is breadth first : b+ b + + b 2 t( n) nodes and le Ob t( n) = ( ) t( n) O( t( n)) aves Time for processing one node (or leaf) starting from root Otn ( ( )) Running time of deterministic 3-tape TM Otn ( ( )). Ob ( ) = 2 Use transformation to deterministic single tape gives (2 ) = 2 Otn (( )) 2 Otn (( )) Differences in models Polynomial difference between singleand multiple tape deterministic TM Exponential difference between deterministic and non-deterministic TM Compare exponential versus polynomial behaviour!
9 Towards the class P Distinction between : Exponential algorithms Brute force search Impractical Polynomial Practical Robust for reasonable models of computation (I.e. polynomially equivalent) Here, we ignore differences between, 5 e.g. On ( )and On ( ), level of abstraction Definition The class P P is the class of languages that are decidable in polynomial time on a deterministic single -tape TM, i.e. P= TIME( n ) U P is invariant for all models of computation that are polynomially equivalent to a single tape deterministic TM P roughly corresponds to the class of problems that are realistically solvable on a computer
10 Conventions High-level descriptions of algorithms Abstraction of specific model used (as long as polynomially equivalent) Algorithms proceed in numbered stages Analysis in two steps : A polynomial bound on the number of stages Each stage can be implemented in polynomial time on deterministic single tape TM (or poly. Equivalent model) Conventions Encoding method for problems We use <.> notation as before Reasonable methods require encoding and decoding of objects into other (internal?) representation to require polynomial time. E.g (unreasonable) instead of 9 (or other base -notation)
11 Option 1 : Encoding Graphs List of nodes List of edges Option 2 : Adjacency matrix 1 iff there is an edge from node i to node j Entry ( i, j) = 0 otherwise PATH = { < G, s, t > G is a directed graph that has a directed path from s to t} Figure 7.2
12 Theorem PATH P Insert algorithm RELPRIME = { < x, y > x and y are relative prime} i.e. the greatest common divisor of x and y is 1 Theorem RELPRIME P Insert algorithm
13 Theorem Every context-free language is a member of P Assume language in Chomsy Normal Form Then each derivation of a string whas 2n 1steps (Generating all derivations is not polynomial!) Dynamic programming : accumulate information about smaller problems eep trac of table of size n n table( i, j) = the set of variables generating w... w with i j i j
14 Towards the class NP HAMPATH = { < G, s, t > G is a directed graph with a hamiltonian path from s to g} i.e. it is directed and contains all nodes in G HAMPATH Easy to obtain exponential time algorithm : Generate all paths of length m (no. of nodes) and chec whether they are hamiltonian Polynomial verifiability : Checing whether a given path is hamiltonian can be done in polynomial time Verifying existence of hamiltonian path is easier than determining the existence Consider also HAMPATH Similar for COMPOSITES COMPOSITES = { x x = p. q for integers p, q > 1}
15 The class NP Definition A verifier for a language A is an algorithm Vs.t. A= { w V accepts < w, c> for some string c} c : certificate, proof Time of verifiers is measured in terms of size of w (implies that c is of size polynomial in size w) Polynomial time verifiers Definition NPis the class of languages that have polynomial time verifiers NP comes from Nondeterministic polynomial time NTM for HAMPATH Algorithm
16 Theorem A language is in NP iff it is decided by some nondeterministic polynomial time algorithm idea Proof Definition NTIME( tn ( )) = { L Lis a language decided by an Otn ( ( )) time NTM} Corollary U NP= NTIME( n ) CLIQUE = { < G, > G is an undirected graph with a -clique}
17 Theorem CLIQUE is in NP SUBSET SUM = { < S, t > S = { x,..., x } and for some { y,..., y } { x,..., x }we have y = t} The y and x are multi-sets. 1 1 l 1 i i Theorem SUBSET SUM is in NP
18 P versus NP P versus NP P= the class of languages where membership can be decided quicly NP=the class of languages where membership can be verified quicly n NP EXPTIME= UTIME(2 ) NP-complete problems : if a polynomial time (determ.) algorithm exists for one NP-complete problem, then P=NP
19 Boolean Logic true is denoted by 1 false is denoted by 0 and or not SAT = { < φ > φ is a satisfiable boolean formula} Theorem (Coo-Levin) SAT P iff P=NP 0 0= 0 0 0= 0 0= 0= 1 0 1= 0 0 1= 1 1= 1= 0 1 0= 0 1 0= 1 1 1= 1 1 1= 1 A Boolean formula is an expression involving Boolean variables and operations E.g. φ=( x y) ( x z) Assignment of values (0 and 1) to variables For each assignment one can evalue a formula If the formula evaluates to 1, we say that the assignment satisfies the formula. The satisfiabilit y problem is to test whether a formula is satisfiable (i.e. whether there exists an assignment that satisfies the formula) A function f : Σ Σ Polynomial time reducibility Fig 7.6 * * is a polynomial time computable function if some polynomial time TM M exists that halts with just f( w) on its tape, when started on any input w Language Ais polynomial time (mapping) reducible to language B written A B, if a polynomial time computable function f : Σ Σ P exists where for every w: w Aiff f( w) B f is a polynomial time reduction * *
20 Theorem If A B and B P, then A P P Proof: N wors in polynomial time 3 SAT{ < φ > φis a satisfiable 3cnf formula} cnf : conjunctive normal form, i.e. a conjunction of disjunctions (disjunctions are clauses, elements of disjunctions are literals) 3cnf : each clause/disjunction has exactly three literals e.g. ( x y z) ( y x w) Theorem 3SATis polynomial time reducible to CLIQUE Proof Let φ be of the form ( a b c )... ( a b c ) f( φ) =< G, > where all nodes in G are organised in triples t1,..., t each triple corresponds to a cluase and has 3 nodes The edges of G connect all nodes except for : 1. edges between the nodes of the same triple 2. nodes with contradictory label, i.e. x and x Now prove that f is a polynomial time reduction
21 Fig 7.7 NP-completeness Definition A language B is NP-complete if 1. B is in NP, and 2. every A in NP is polynomial time reducible to Theorem If B is NP-complete and B P, then P=NP Theorem If Bis NP-complete and B C for C in NP, then C is NP-complete P B
22 Theorem Coo-Levin SAT is NP-complete Proof 1. SAT is in NP (easy) 2. any language A in NP is polynomial time reducible to SAT Let N be a NTM that decides Ain time n Define an (accepting) tableau for N on w define reduction f from Ato SAT on input w, define f( w) let us first define the boolean variables. Let C = Q Γ {#} for 1 i, j n, for s C: define x = cell( i, j) contains symbol s i, j, s Now define φ = φ φ φ cell start move φ accept ( x,,) ( ( x,, x,,)) s C s, t C, s t φ = "each cell contains exactly one symbol" cell i j s i j s i j t 1 i, j n φ = x x x... x x... x x start q w n+ w n+ n n 1,1,# 1,2, 0 1,3, 1 1, 2, 1, 3, n 1, 1, 1,,# "the first row corresponds to the starting situation"
23 φ accept = 1 i, j n x i, j, q accept "at least one of the configurations is an accept state" concept of legal windows e.g. δ( q, a) = {( q, b, R)} and δ( q, b) = {( q, c, L),( q, a, R)} Claim if the top row of the table is the start configuration and if every window (2x3) is legal then each row legally follows the preceding one. φ move 1 6 = 1 < i n,1< j< n for each window : a,..., a is a legal window "the i, j window is legal" ( x x x x x x ) i, j 1, a i, j, a i, j+ 1, a i+ 1, j 1, a i+ 1, j, a i+ 1, j+ 1, a Analyze the complexity tableau has n n = n 2 cells each cell has lvariables (for symbols in C) thus number of variables is On ( ) Now investigate different components of φ = φ φ φ φ On On O n) 2 (All ( ) or ( ); indices can be encoded in (log cell start move accept f( w)is of polynomial size and can be computed in polynomial time
24 Theorem 3SATis NP-complete Proof modify construction in SATproof first rewrite φ in cnf form. second rewrite clauses such that they have 3 literals 1. if less than 3 literals e.g. a brewrite to e.g. a b b 2. if more than 3 literals ( a... a ) rewrite into ( a a z ) ( z a z ) ( z a a ) l 3 l 1 l 1 l Corollary CLIQUE is NP-complete VERTEX COVER = { < G, > Gis an undirected graph that has a -node vertex cover} Let Gbe an undirected graph ( V, E) and a number A vertex cover is a set of nodes V ' Vsuch that for all edges ( uv, ) Eholds that u V 'or v V ' Theorem VERTEX COVER is NP-complete Proof produce clause gadget and variable gadget set = m+ 2l where φ has m variables and l clauses then prove satisfiability if and only if graph has a vertex cover with nodes
25 Theorem HAMPATH is NP-complete Proof we show that 3SAT P HAMPATH Let φ be of the form ( a b c )... ( a b c ) 1 1 1
26 UHAMPATH = { < G > Gis an undirected graph that contains a hamiltonian path} Theorem UHAMPATH is NP-complete Proof HAMPATH f( G) = G' P UHAMPATH in mid out for all nodes u in G, introduce nodes u, u, u in G' out for s and t in G, introduce only s, t introduce edges between u and u and between u and u out in connect also u to v if there is an edge from u to v each path su,,..., u, tin Ghas a counterpart 1 in mi d out in 1 1 u t out s, u, u, 1,..., and vice versa in in mid mid out
27 SUBSET SUM = { < S, t > S = { x,..., x } and for some { y,..., y } { x,..., x }we have y = t} The y and x are multi-sets. 1 1 l 1 i i Theorem SUBSET SUM is NP-complete. Proof 1. SUBSET SUM NP 2.3SAT SUBSET SUM P Let φ be in 3cnf and have vars x,..., x and clauses c,..., c 1 l 1 Set Covering SetCover={< T,..., T, M, n> T M (finite set) and there exist n 1 sets T,..., T such that T = M} i1 in i j U j i Example <{a,b,c},{b,c,d},{c.d},{a,b,c,d},2> SetCover <{a,b,c},{b,c,d},{c.d},{a,b,c,d},1> SetCover
28 BinPacing BinPacing={< a,..., a,, b> a b (all in ) and the objects a 1 n i i be divided over the bins of size b such that no bin overflows} Example <4,5,7,2,2,9> BinPacing because 4+5 and 7+2 are both smaller than 9 2 bins of size 9 <4,5,7,2,2,8> BinPacing Traveling Salesman Problem TSP={< M, > M contains distance between city iand j ij and there exists a path through all cities of size less than } path 1,2,3 is a solution for 9 instead of 10, no solution
29 Coloring Coloring={< G, > Gis a graph and there exists a coloring with colors so that no two adjacent have the same color} Key Reductions SAT 3SAT SetCover Clique SubsetSum Hampath Coloring VertexCover Partition UHampath BinPacing TSP
30 Conclusions The class P The class NP NP-completeness(e.g. 3SAT) Polynomial time reductions Two further classes : conp: conp={ A A NP} NP-hard: A language B is NP-hard if every A in NP is polynomial time reducible to B Standard Reference Garey and Johson, Computers and Intractability A guide to the theory of NPcompleteness, W.H.Freeman, 1979.
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 informationCISC 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 informationTime Complexity. CS60001: Foundations of Computing Science
Time Complexity CS60001: Foundations of Computing Science Professor, Dept. of Computer Sc. & Engg., Measuring Complexity Definition Let M be a deterministic Turing machine that halts on all inputs. The
More informationTIME 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 informationTime Complexity (1) CSCI Spring Original Slides were written by Dr. Frederick W Maier. CSCI 2670 Time Complexity (1)
Time Complexity (1) CSCI 2670 Original Slides were written by Dr. Frederick W Maier Spring 2014 Time Complexity So far we ve dealt with determining whether or not a problem is decidable. But even if it
More informationCSE 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 informationCSE 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 informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/ Today's learning goals Sipser Ch 7 Distinguish between computability and complexity Articulate motivation questions
More informationChapter 7: Time Complexity
Chapter 7: Time Complexity 1 Time complexity Let M be a deterministic Turing machine that halts on all inputs. The running time or time complexity of M is the function f: N N, where f(n) is the maximum
More informationP 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 informationPolynomial time reduction and NP-completeness. Exploring some time complexity limits of polynomial time algorithmic solutions
Polynomial time reduction and NP-completeness Exploring some time complexity limits of polynomial time algorithmic solutions 1 Polynomial time reduction Definition: A language L is said to be polynomial
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 7.2, 7.3 Distinguish between polynomial and exponential DTIME Define nondeterministic
More informationCS154, 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 informationCS154, 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 informationBBM402-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 informationComputational Models Lecture 11, Spring 2009
Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models Lecture 11, Spring 2009 Deterministic Time Classes NonDeterministic Time Classes
More information6.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 informationComplexity (Pre Lecture)
Complexity (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2018 Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall 2018 1 / 70 Why? What can we always compute efficiently? What
More information22c:135 Theory of Computation. Analyzing an Algorithm. Simplifying Conventions. Example computation. How much time does M1 take to decide A?
Example computation Consider the decidable language A = {0 n 1 n n 0} and the following TM M1 deciding A: M1 = "On input string w: 1. Scan across the tape and reject if a 0 appears after a 1 2. Repeat
More informationCS154, 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 informationLecture 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 informationFORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) Spring l. Blum TIME COMPLEXITY AND POLYNOMIAL TIME;
15-453 TIME COMPLEXITY AND POLYNOMIAL TIME; FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY NON DETERMINISTIC TURING MACHINES AND NP THURSDAY Mar 20 COMPLEXITY THEORY Studies what can and can t be computed
More informationChapter 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 informationNP 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 informationComputability 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 informationTheory 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 informationCS311 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 informationCSE 105 Theory of Computation
CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Today s Agenda P and NP (7.2, 7.3) Next class: Review Reminders and announcements: CAPE & TA evals are open: Please
More informationLecture 17: Cook-Levin Theorem, NP-Complete Problems
6.045 Lecture 17: Cook-Levin Theorem, NP-Complete Problems 1 Is SAT solvable in O(n) time on a multitape TM? Logic circuits of 6n gates for SAT? If yes, then not only is P=NP, but there would be a dream
More informationNP-Completeness. A language B is NP-complete iff B NP. This property means B is NP hard
NP-Completeness A language B is NP-complete iff B NP A NP A P B This property means B is NP hard 1 3SAT is NP-complete 2 Result Idea: B is known to be NP complete Use it to prove NP-Completeness of C IF
More information1 Non-deterministic Turing Machine
1 Non-deterministic Turing Machine A nondeterministic Turing machine is a generalization of the standard TM for which every configuration may yield none, or one or more than one next configurations. In
More informationFinish 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 informationComputability and Complexity
Computability and Complexity Lecture 10 More examples of problems in P Closure properties of the class P The class NP given by Jiri Srba Lecture 10 Computability and Complexity 1/12 Example: Relatively
More informationLecture 13, Fall 04/05
Lecture 13, Fall 04/05 Short review of last class NP hardness conp and conp completeness Additional reductions and NP complete problems Decision, search, and optimization problems Coping with NP completeness
More informationIntro 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 informationComplexity: moving from qualitative to quantitative considerations
Complexity: moving from qualitative to quantitative considerations Textbook chapter 7 Complexity Theory: study of what is computationally feasible (or tractable) with limited resources: running time (main
More informationAsymptotic notation : big-o and small-o
Time complexity Here we will consider elements of computational complexity theory an investigation of the time (or other resources) required for solving computational problems. We introduce a way of measuring
More informationNP and Computational Intractability
NP and Computational Intractability 1 Review Basic reduction strategies. Simple equivalence: INDEPENDENT-SET P VERTEX-COVER. Special case to general case: VERTEX-COVER P SET-COVER. Encoding with gadgets:
More informationIntroduction 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 informationThe 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
More informationComplexity 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 informationOutline. 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 informationCS5371 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 informationNP-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 informationLecture 19: Finish NP-Completeness, conp and Friends
6.045 Lecture 19: Finish NP-Completeness, conp and Friends 1 Polynomial Time Reducibility f : Σ* Σ* is a polynomial time computable function if there is a poly-time Turing machine M that on every input
More informationan 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 informationCS 6505, Complexity and Algorithms Week 7: NP Completeness
CS 6505, Complexity and Algorithms Week 7: NP Completeness Reductions We have seen some problems in P and NP, and we ve talked about space complexity. The Space Hierarchy Theorem showed us that there are
More informationComputability Theory
CS:4330 Theory of Computation Spring 2018 Computability Theory P versus NP and NP-Completeness Haniel Barbosa Readings for this lecture Chapter 7 of [Sipser 1996], 3rd edition. Section 7.4. The P versus
More informationComplexity, P and NP
Complexity, P and NP EECS 477 Lecture 21, 11/26/2002 Last week Lower bound arguments Information theoretic (12.2) Decision trees (sorting) Adversary arguments (12.3) Maximum of an array Graph connectivity
More informationECE 695 Numerical Simulations Lecture 2: Computability and NPhardness. Prof. Peter Bermel January 11, 2017
ECE 695 Numerical Simulations Lecture 2: Computability and NPhardness Prof. Peter Bermel January 11, 2017 Outline Overview Definitions Computing Machines Church-Turing Thesis Polynomial Time (Class P)
More information1. 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 informationCS154, 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 informationComputational 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 informationNP 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 informationAnnouncements. 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 informationNP-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 informationNP-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 informationTheory of Computation
Theory of Computation Dr. Sarmad Abbasi Dr. Sarmad Abbasi () Theory of Computation 1 / 38 Lecture 21: Overview Big-Oh notation. Little-o notation. Time Complexity Classes Non-deterministic TMs The Class
More informationNP-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 informationNP-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 informationAutomata 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 informationCorrectness 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 informationNP-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 informationIntractable Problems [HMU06,Chp.10a]
Intractable Problems [HMU06,Chp.10a] Time-Bounded Turing Machines Classes P and NP Polynomial-Time Reductions A 10 Minute Motivation https://www.youtube.com/watch?v=yx40hbahx3s 1 Time-Bounded TM s A Turing
More informationSummer 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 informationSAT, Coloring, Hamiltonian Cycle, TSP
1 SAT, Coloring, Hamiltonian Cycle, TSP Slides by Carl Kingsford Apr. 28, 2014 Sects. 8.2, 8.7, 8.5 2 Boolean Formulas Boolean Formulas: Variables: x 1, x 2, x 3 (can be either true or false) Terms: t
More informationSAT, 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 informationP, 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 informationCS5371 Theory of Computation. Lecture 18: Complexity III (Two Classes: P and NP)
CS5371 Theory of Computation Lecture 18: Complexity III (Two Classes: P and NP) Objectives Define what is the class P Examples of languages in P Define what is the class NP Examples of languages in NP
More informationDesign 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 informationLecture 3: Nondeterminism, NP, and NP-completeness
CSE 531: Computational Complexity I Winter 2016 Lecture 3: Nondeterminism, NP, and NP-completeness January 13, 2016 Lecturer: Paul Beame Scribe: Paul Beame 1 Nondeterminism and NP Recall the definition
More informationLecture 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
More informationFriday 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 informationPolynomial-Time Reductions
Reductions 1 Polynomial-Time Reductions Classify Problems According to Computational Requirements Q. Which problems will we be able to solve in practice? A working definition. [von Neumann 1953, Godel
More informationCS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP
CS 301 - Lecture 29 P, NP, and NP-Completeness Fall 2008 Review Languages and Grammars Alphabets, strings, languages Regular Languages Deterministic Finite and Nondeterministic Automata Equivalence of
More informationTuring 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 informationCS 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 informationCOMP 382. Unit 10: NP-Completeness
COMP 382 Unit 10: NP-Completeness Time complexity 1 log n n n 2 n 3 2 n n n Space complexity 1 log n n n 2 n 3 2 n n n Complexity theory Focus on decidability (yes/no) problems What is P? Deterministic,
More informationCOP 4531 Complexity & Analysis of Data Structures & Algorithms
COP 4531 Complexity & Analysis of Data Structures & Algorithms Lecture 18 Reductions and NP-completeness Thanks to Kevin Wayne and the text authors who contributed to these slides Classify Problems According
More informationP 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 informationDefinition: conp = { L L NP } What does a conp computation look like?
Space Complexity 28 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 y of x k length and the machine accepts
More informationQuiz 3. Please write your name in the upper corner of each page. Problem Points Grade. Total 100 Q3-1
6.045J/18.400J: Automata, Computability and Complexity April 28, 2004 Quiz 3 Prof. Nancy Lynch, Nati Srebro Susan Hohenberger Please write your name in the upper corner of each page. Problem Points Grade
More informationCS 3719 (Theory of Computation and Algorithms) Lectures 23-32
CS 3719 (Theory of Computation and Algorithms) Lectures 23-32 Antonina Kolokolova March 2011 1 Scaling down to complexity In real life, we are interested whether a problem can be solved efficiently; just
More informationEasy 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 informationCS21 Decidability and Tractability
CS21 Decidability and Tractability Lecture 20 February 23, 2018 February 23, 2018 CS21 Lecture 20 1 Outline the complexity class NP NP-complete probelems: Subset Sum NP-complete problems: NAE-3-SAT, max
More informationShow 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 informationU.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 informationNP-Completeness. Sections 28.5, 28.6
NP-Completeness Sections 28.5, 28.6 NP-Completeness A language L might have these properties: 1. L is in NP. 2. Every language in NP is deterministic, polynomial-time reducible to L. L is NP-hard iff it
More informationAdvanced 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 informationComputational 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 informationIntroduction. 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 informationReview 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 informationEssential 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 informationChapter 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 informationTheory of Computation Chapter 9
0-0 Theory of Computation Chapter 9 Guan-Shieng Huang May 12, 2003 NP-completeness Problems NP: the class of languages decided by nondeterministic Turing machine in polynomial time NP-completeness: Cook
More informationCS 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 informationUndecidable 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 informationCSE 555 HW 5 SAMPLE SOLUTION. Question 1.
CSE 555 HW 5 SAMPLE SOLUTION Question 1. Show that if L is PSPACE-complete, then L is NP-hard. Show that the converse is not true. If L is PSPACE-complete, then for all A PSPACE, A P L. We know SAT PSPACE
More informationThe 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