Algorithms and Complexity Theory. Chapter 8: Introduction to Complexity. Computer Science - Durban - September 2005

Size: px
Start display at page:

Download "Algorithms and Complexity Theory. Chapter 8: Introduction to Complexity. Computer Science - Durban - September 2005"

Transcription

1 Algorithms and Complexity Theory Chapter 8: Introduction to Complexity Jules-R Tapamo Computer Science - Durban - September 2005 Contents 1 Introduction Dynamic programming Heuristics: Travelling Salesperson problem Polynomial Problems Examples of Polynomial Problems Examples of non Polynomial Problems Decision Problems Examples decision Problem Polynomial reduction Example of Polynomial reductions HC P T SP Properties of Polynomial reductions N P Class N P Structure N P-complete Problems How to Show that a problem is N P-complete Propositional Calculus Some Known N P-complete problems P = N P?

2 2 1 INTRODUCTION 1 Introduction A paradigm is a model or example of environment and methodology in which systems and softwares are developed and operated. Algorithmic schema use to design an algorithmic solution for a given problem. - Divide-and-conquer (Mergesort, Convex hull, etc). - Dynamic Programming (Matrix-Chain-Multiplication, All pairs Shortest Path,etc.) - etc. An heuristic is an approximation model, based on domain knowledge from a particular application, that give guidance in the solution of problem. - Travelling Salesperson problem The complexity classes allow to classify problems and to give common algorithmic solution to some problems using transformations called adequate reduction. 1.1 Dynamic programming - Is an example of paradigm - suppose we want to multiply a sequence of n matrices M 1 M 2... M n It is possible to give a method to compute using parenthesis: M 1 M 2 M 3 M 4 can be computed using one the five following schemas : 1. M1(M2(M3M4)) 2. M1((M2M3)M4) 3. (M1M2)(M3M4) 4. (M1(M2M3))M4 5. ((M1M2)M3)M4. For n matrices there are T (n) = 1 n ( 2(n-1) n-1 ways to compute M 1 M 2... M n Each way has a cost: the number of scalar multiplications required to compute the product. The cost depends on the schema. We want to minimize the cost of the multiplication. From the chapter on Dynamic programming we know that to compute: ) M 1 M 2... M n we can use an O(n 3 ) time and O(n 2 ) space algorithm to compute the best way to do it. 1.2 Heuristics: Travelling Salesperson problem The salesperson wants to minimize the total travelling cost (cost, or distance) required to visit all the cities( n cities ) in a territory, and returns to the starting point. Means given a complete, weighted graph and an integer k, is there a hamiltonian cycle with total weight at most k. - It is an exponential solution O(2 n ). Search algorithms, backtracking, branch-and-bound, etc. - one prefers to compute efficiently the approached solution: Compute the Minimum Spanning Tree

3 3 And then Depth-First-Search the minimum spanning tree then cancel multiple occurrences of cities and create short-cut. 2 Polynomial Problems When can we say that an algorithm is efficient? Will we require that the time complexity be an O(n 3 ), O(n 2 ) or yet O(n)? There is not absolute answer to this question, but some significant limitations we can point out! An exponential complexity (O(c n ) for n > 1) is almost always excessive. We will then consider as acceptable all function with polynomial complexity, means O(n k ) for a given k. In other words, an efficient algorithm will be a polynomial algorithm. The class P (Polynomial) is the set of problems which can be solved by deterministic polynomial algorithm. 2.1 Examples of Polynomial Problems EXAMPLE Quicksort of n items - product of 2 n-digits integers - etc. 2.2 Examples of non Polynomial Problems EXAMPLE Travelling Salesperson Problem (TSP). Given a set of n cities, a distance D, and for every pair of cities, the distance d(v i, v j ) from the city v i to the city v j. The salesperson wants to minimize the total traveling cost (cost, or distance) required to visit all the cities( n cities ) in a territory, and returns to the starting point. Means to find a permutation v p1, v p2,..., v pn such that 1 i<n d(v pi, v pi+1 ) + d(v pn, v p1 ) D There is a straightforward algorithm for the problem: - compute the sum for all the possible permutation. but, the number of permutation is equal to n!. and then the algorithm is not polynomial.

4 4 4 POLYNOMIAL REDUCTION EXAMPLE Hamiltonian cycle (HC) In an undirected graph is a simple cycle that passes through every vertex exactly once. The problem is to determine if there exists an hamiltonian cycle in a graph G=(V,E). Means we have to find a permutation v p1, v p2,..., v pn of vertices such that (v pi, v pi+1 ) E, i 1 i < n and (v pn, v p1 ) E. As for TSP to try all the permutations is an algorithm which can allow us to solve the problem. But this algorithm is not polynomial. It is possible to build a relation between the two problems. 3 Decision Problems A Decision Problem is a question that has two possible answers, Yes and No. The question is about some input. A Problem Instance is the combination of the problem and a specific input. Usually the statement has two part: 1. Instance Description part defines the information expected in input. 2. The question part states the actual Yes-or-No question; the question contains variables defined in the instance description. 3.1 Examples decision Problem EXAMPLE TSP: Given a complete, Weighted graph and an integer D, Is there an Hamiltonian cycle with total weight at most D? EXAMPLE HC : Does a given Undirected Graph have a Hamiltonian cycle? 4 Polynomial reduction Let P 1 and P 2 be two decision problems. A polynomial reduction from P 1 to P 2 is a function, f, from the input set for the decision problem P 1 into the input set for the decision problem Q such that the following hold: 1. f can be computed in polynomial time. 2. f computes from an instance x of problem P 1 an instance f(x) of problem P 2 such that the instance x is true if and only if the instance f(x) is true. A problem P 1 is polynomially reducible to P 2 if there exists a polynomial reduction ( transformation) from P 1 to P 2. The notation is P 1 P P Example of Polynomial reductions There exists a polynomial transformation from HC to TSP. To establish this property, describe the polynomial algorithm which transforms an instance of HC to instance of TSP which is true if and only if the instance of HC is true. Let an instance of HC be defined by G = (V,E). The transformation of this instance is the instance of TSP (C, d(v i, v j ), D) describe as follows:

5 4.2 HC P T SP 5 C is the set of cities, C = V the distances { are given by 1 if (vi, v d(v i, v j ) = j ) E 2 if (v i, v j ) / E the constant D is the number of cities ie : D = V This transformation is polynomial because: - it takes the list of vertices to create the list of cities - determines the distances between every pair of cities from the description of the edges of graph. Each of those two operations can be achieved in polynomial time. 4.2 HC P T SP Suppose first the instance of TSP we have build is true. If there exists a traversal of cities of length D = V, this traversal can only contains path between cities, means with length 1. Indeed, as each distance is 1 or 2 and the traversal contains V paths, to have length V each path must have length 1. But each path between cities with length 1 corresponds to an edge of graph G defining the instance of HC. Then a traversal of cities with length D corresponds to a hamiltonian cycle of G. If the instance of HC is true, there exists an hamiltonian cycle in G. Using the corresponding instance in TSP, the cycle defines a traversal of cities using only paths with length 1 and then the total length is V. Thus the TSP instance we will obtain is then true. 4.3 Properties of Polynomial reductions Lemma 1 if P 1 P P 2 then Proof if P 2 P then P 1 P if P 1 / P then P 2 / P if P 2 P then P 1 P If there exists a polynomial algorithm to solve P 2, as an instance of P 1 can be reduce to an instance of P 2 then it exists an polynomial algorithm to solve P 1. if P 1 / P then P 2 / P If P 1 / P, if we conclude that P 2 P then from the first part we obtain P 1 P which is a contradiction. Lemma 2 The polynomial transformations are transitive: if P 1 P P 2 and P 2 P P 3 then P 1 P P 3 Proof The transformation from P 1 to P 3 is obtained by composition of the transformations from P 1 to P 2 and the transformation from P 2 to P 3.

6 6 5 N P CLASS Two problems are polynomially equivalent, notation P 1 P P 2, if and only if P 1 P P 2 and P 2 P P 1 Example HC and TSP are polynomially equivalent 5 N P Class The class N P (Non Deterministic Polynomial) is the set of problems which can be solved by non deterministic polynomial algorithm. Non deterministic allow to choose an instruction within a set of instructions such that algorithm converges to the solution if it exists. HC and TSP are in N P. HC is N P the following non deterministic algorithm solves the problem: The algorithm generates in a non deterministic manner a permutation of the vertices of graph. The number of steps of this phase is proportional to the number of vertices of graph, which is polynomial. then the algorithm verifies that the permutation computed in the first part is an hamiltonian cycle, and the answer is true of false. 5.1 N P Structure Lemma 3 The N P class contains P ( P N P) Proof Immediate, because deterministic polynomial algorithms are particular cases of Non deterministic polynomial algorithms. 5.2 N P-complete Problems A problem P is N P-hard if every Q in N P is reducible to P (Q P P). A problem P is N P-complete if: 1. P N P 2. P is N P - hard Theorem If any N P-complete problem is in P, then P = N P Proof if P P and P is N P-complete = P N P and Q N P,Q P P. = Q N P, Q P = N P P (1) (1) and Lemma 3 = P = N P

7 5.3 How to Show that a problem is N P-complete How to Show that a problem is N P-complete To prove Q is N P-complete choose some known N P-complete problem P and reduce P to Q, 1. If P is N P-complete, all problem R N P are reducible to P; that is R P P 2. Show P P Q 3. Then all problems R N P satisfy R P Q by transitivity of reductions 4. Therefore Q is N P-complete. 5.4 Propositional Calculus Here we are interested with Conjunctive Normal Form. A Conjunctive Normal Form is an expression of form: E 1 E 2... E i... E k where E i is a clause. a clause is a disjunction of propositional variables or a negation of propositional variables, means x 1 x 2... x j... x l where x j is a literal. A literal is an expression with form p or p Example (p p) p (q r s t) (s t) An Expression is Satisfiable if there exists at least on interpretation function for which it is true. An Interpretation function is the one which assigns truth values to the propositional variables. The satisfiability problem is : Given a formula of propositional calculus in conjunctive normal form is it satisfiable? It is denoted SAT-problem. 5.5 Some Known N P-complete problems Cook s Theorem The SAT-Problem is N P-complete. Graph Coloring : Given an undirected Graph G=(V,E) and a positive integer k, is there a coloring of G using at most k colors? Knapsack Problem : Let S be a set of integers and t an integer, is there a subset A S such that x A x = t? TSP HC P = N P? Big question in Computer Science When we find an N P-complete problem, we try to use an heuristics, means approximations. And we have to give bounds of those approximations. Usually we want to have an polynomial heuristics. there are theoretical limits of computers. There is a Lack of practical and efficient algorithms.

8 8 5 N P CLASS Bibliography 1. Cormen T. H., Leiserson C.E. and Rivest R. L., Introduction to Algorithms, McGraw-Hill, Baase S. and Gelder A., Computer Algorithms: Introduction to Design and Analysis, Addison Wesley, Lewis H. R. and Papadimitriou C.H., Elements of the Theory of Computation, Prentice Hall International,1981.

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

Polynomial-Time Reductions

Polynomial-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 information

NP and Computational Intractability

NP and Computational Intractability NP and Computational Intractability 1 Polynomial-Time Reduction Desiderata'. Suppose we could solve X in polynomial-time. What else could we solve in polynomial time? don't confuse with reduces from Reduction.

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

8.5 Sequencing Problems

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

More information

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2) Algorithms and Theory of Computation Lecture 22: NP-Completeness (2) Xiaohui Bei MAS 714 November 8, 2018 Nanyang Technological University MAS 714 November 8, 2018 1 / 20 Set Cover Set Cover Input: a set

More information

Algorithms. NP -Complete Problems. Dong Kyue Kim Hanyang University

Algorithms. NP -Complete Problems. Dong Kyue Kim Hanyang University Algorithms NP -Complete Problems Dong Kyue Kim Hanyang University dqkim@hanyang.ac.kr The Class P Definition 13.2 Polynomially bounded An algorithm is said to be polynomially bounded if its worst-case

More information

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

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

More information

1. (a) Explain the asymptotic notations used in algorithm analysis. (b) Prove that f(n)=0(h(n)) where f(n)=0(g(n)) and g(n)=0(h(n)).

1. (a) Explain the asymptotic notations used in algorithm analysis. (b) Prove that f(n)=0(h(n)) where f(n)=0(g(n)) and g(n)=0(h(n)). Code No: R05220502 Set No. 1 1. (a) Explain the asymptotic notations used in algorithm analysis. (b) Prove that f(n)=0(h(n)) where f(n)=0(g(n)) and g(n)=0(h(n)). 2. (a) List some of the relative advantages

More information

Lecture 4: NP and computational intractability

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

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

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

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

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

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

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

CS/COE

CS/COE CS/COE 1501 www.cs.pitt.edu/~nlf4/cs1501/ P vs NP But first, something completely different... Some computational problems are unsolvable No algorithm can be written that will always produce the correct

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

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

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

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

More information

Polynomial-time reductions. We have seen several reductions:

Polynomial-time reductions. We have seen several reductions: Polynomial-time reductions We have seen several reductions: Polynomial-time reductions Informal explanation of reductions: We have two problems, X and Y. Suppose we have a black-box solving problem X in

More information

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

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

More information

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

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-Complete Problems. More reductions

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

More information

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

Data Structures and Algorithms (CSCI 340)

Data Structures and Algorithms (CSCI 340) University of Wisconsin Parkside Fall Semester 2008 Department of Computer Science Prof. Dr. F. Seutter Data Structures and Algorithms (CSCI 340) Homework Assignments The numbering of the problems refers

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

ECS122A Handout on NP-Completeness March 12, 2018

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

More information

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

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

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

More information

CS 5114: Theory of Algorithms

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

More information

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

VIII. NP-completeness

VIII. NP-completeness VIII. NP-completeness 1 / 15 NP-Completeness Overview 1. Introduction 2. P and NP 3. NP-complete (NPC): formal definition 4. How to prove a problem is NPC 5. How to solve a NPC problem: approximate algorithms

More information

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

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

More information

Chapter 8. NP and Computational Intractability

Chapter 8. NP and Computational Intractability Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. Acknowledgement: This lecture slide is revised and authorized from Prof.

More information

Design and Analysis of Algorithms

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

More information

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

SAT, Coloring, Hamiltonian Cycle, TSP

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

More information

CS 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

Una descrizione della Teoria della Complessità, e più in generale delle classi NP-complete, possono essere trovate in:

Una descrizione della Teoria della Complessità, e più in generale delle classi NP-complete, possono essere trovate in: AA. 2014/2015 Bibliography Una descrizione della Teoria della Complessità, e più in generale delle classi NP-complete, possono essere trovate in: M. R. Garey and D. S. Johnson, Computers and Intractability:

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

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

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

More information

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

There are two types of problems:

There are two types of problems: Np-complete Introduction: There are two types of problems: Two classes of algorithms: Problems whose time complexity is polynomial: O(logn), O(n), O(nlogn), O(n 2 ), O(n 3 ) Examples: searching, sorting,

More information

Unit 1A: Computational Complexity

Unit 1A: Computational Complexity Unit 1A: Computational Complexity Course contents: Computational complexity NP-completeness Algorithmic Paradigms Readings Chapters 3, 4, and 5 Unit 1A 1 O: Upper Bounding Function Def: f(n)= O(g(n)) if

More information

8.5 Sequencing Problems. Chapter 8. NP and Computational Intractability. Hamiltonian Cycle. Hamiltonian Cycle

8.5 Sequencing Problems. Chapter 8. NP and Computational Intractability. Hamiltonian Cycle. Hamiltonian Cycle Chapter 8 NP and Computational Intractability 8.5 Sequencing Problems Basic genres. Packing problems: SET-PACKING, INDEPENDENT SET. Covering problems: SET-COVER, VERTEX-COVER. Constraint satisfaction problems:

More information

Algorithms, Lecture 3 on NP : Nondeterminis7c Polynomial Time

Algorithms, Lecture 3 on NP : Nondeterminis7c Polynomial Time Algorithms, Lecture 3 on NP : Nondeterminis7c Polynomial Time Last week: Defined Polynomial Time Reduc7ons: Problem X is poly 7me reducible to Y X P Y if can solve X using poly computa7on and a poly number

More information

Theory of Computation Chapter 9

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

Computability and Complexity Theory

Computability and Complexity Theory Discrete Math for Bioinformatics WS 09/10:, by A Bockmayr/K Reinert, January 27, 2010, 18:39 9001 Computability and Complexity Theory Computability and complexity Computability theory What problems can

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

Data Structures in Java

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

More information

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

CS 5114: Theory of Algorithms. Tractable Problems. Tractable Problems (cont) Decision Problems. Clifford A. Shaffer. Spring 2014 Department of Computer Science Virginia Tech Blacksburg, Virginia Copyright c 2014 by Clifford A. Shaffer : Theory of Algorithms Title page : Theory of Algorithms Clifford A. Shaffer Spring 2014 Clifford

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

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

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

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

More information

Graph Theory and Optimization Computational Complexity (in brief)

Graph Theory and Optimization Computational Complexity (in brief) Graph Theory and Optimization Computational Complexity (in brief) Nicolas Nisse Inria, France Univ. Nice Sophia Antipolis, CNRS, I3S, UMR 7271, Sophia Antipolis, France September 2015 N. Nisse Graph Theory

More information

Algorithms Design & Analysis. Approximation Algorithm

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

More information

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

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

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

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

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

Polynomial-time Reductions

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

More information

NP-completeness. 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

INTRO TO COMPUTATIONAL COMPLEXITY

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

More information

CSE 3500 Algorithms and Complexity Fall 2016 Lecture 25: November 29, 2016

CSE 3500 Algorithms and Complexity Fall 2016 Lecture 25: November 29, 2016 CSE 3500 Algorithms and Complexity Fall 2016 Lecture 25: November 29, 2016 Intractable Problems There are many problems for which the best known algorithms take a very long time (e.g., exponential in some

More information

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter 2006 NP-Completeness (Chapter 8) Given positive integers a, b, c Question 1: does there exist a positive integer x such that

More information

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

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

More information

P,NP, NP-Hard and NP-Complete

P,NP, NP-Hard and NP-Complete P,NP, NP-Hard and NP-Complete We can categorize the problem space into two parts Solvable Problems Unsolvable problems 7/11/2011 1 Halting Problem Given a description of a program and a finite input, decide

More information

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

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

More information

Instructor N.Sadagopan Scribe: P.Renjith

Instructor N.Sadagopan Scribe: P.Renjith 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

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

Limits to Approximability: When Algorithms Won't Help You. Note: Contents of today s lecture won t be on the exam

Limits to Approximability: When Algorithms Won't Help You. Note: Contents of today s lecture won t be on the exam Limits to Approximability: When Algorithms Won't Help You Note: Contents of today s lecture won t be on the exam Outline Limits to Approximability: basic results Detour: Provers, verifiers, and NP Graph

More information

Graduate Algorithms CS F-21 NP & Approximation Algorithms

Graduate Algorithms CS F-21 NP & Approximation Algorithms Graduate Algorithms CS673-2016F-21 NP & Approximation Algorithms David Galles Department of Computer Science University of San Francisco 21-0: Classes of Problems Consider three problem classes: Polynomial

More information

More NP-Complete Problems

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

More information

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 8.5 Sequencing Problems Basic genres.! Packing problems: SET-PACKING,

More information

COP 4531 Complexity & Analysis of Data Structures & Algorithms

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

More information

Computational Complexity

Computational Complexity Computational Complexity Ref: Algorithm Design (Ch 8) on Blackboard Mohammad T. Irfan Email: mirfan@bowdoin.edu Web: www.bowdoin.edu/~mirfan Famous complexity classes u NP (non-deterministic polynomial

More information

NP and Computational Intractability

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

More information

Computational Complexity

Computational Complexity Computational Complexity Problems, instances and algorithms Running time vs. computational complexity General description of the theory of NP-completeness Problem samples 1 Computational Complexity What

More information

CS 350 Algorithms and Complexity

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

More information

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

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

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

More information

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

NP-Completeness. Dr. B. S. Panda Professor, Department of Mathematics IIT Delhi, Hauz Khas, ND-16

NP-Completeness. Dr. B. S. Panda Professor, Department of Mathematics IIT Delhi, Hauz Khas, ND-16 NP-Completeness Dr. B. S. Panda Professor, Department of Mathematics IIT Delhi, Hauz Khas, ND-16 bspanda1@gmail.com 1 Decision Problem A problem whose answer is either yes or no ( 1 or 0) Examples: HC

More information

Theory of Computer Science. Theory of Computer Science. E5.1 Routing Problems. E5.2 Packing Problems. E5.3 Conclusion.

Theory of Computer Science. Theory of Computer Science. E5.1 Routing Problems. E5.2 Packing Problems. E5.3 Conclusion. Theory of Computer Science May 31, 2017 E5. Some NP-Complete Problems, Part II Theory of Computer Science E5. Some NP-Complete Problems, Part II E5.1 Routing Problems Malte Helmert University of Basel

More information

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

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

More information

Lecture 15 - NP Completeness 1

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

More information

Admin NP-COMPLETE PROBLEMS. Run-time analysis. Tractable vs. intractable problems 5/2/13. What is a tractable problem?

Admin NP-COMPLETE PROBLEMS. Run-time analysis. Tractable vs. intractable problems 5/2/13. What is a tractable problem? Admin Two more assignments No office hours on tomorrow NP-COMPLETE PROBLEMS Run-time analysis Tractable vs. intractable problems We ve spent a lot of time in this class putting algorithms into specific

More information

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas CSE 417 Introduction to Algorithms Winter 2007 Some Algebra Problems (Algorithmic) Given positive integers a, b, c Question 1: does there exist a positive integer x such that ax = c? NP-Completeness (Chapter

More information

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness Harry Lewis November 19, 2013 Reading: Sipser 7.4, 7.5. For culture : Computers and Intractability: A Guide to the Theory

More information

CS 350 Algorithms and Complexity

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

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

2 COLORING. Given G, nd the minimum number of colors to color G. Given graph G and positive integer k, is X(G) k?

2 COLORING. Given G, nd the minimum number of colors to color G. Given graph G and positive integer k, is X(G) k? 2 COLORING OPTIMIZATION PROBLEM Given G, nd the minimum number of colors to color G. (X(G)?) DECISION PROBLEM Given graph G and positive integer k, is X(G) k? EQUIVALENCE OF OPTIMAIZTION AND DE- CISION

More information

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

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

More information

Algorithm Design Strategies V

Algorithm Design Strategies V Algorithm Design Strategies V Joaquim Madeira Version 0.0 October 2016 U. Aveiro, October 2016 1 Overview The 0-1 Knapsack Problem Revisited The Fractional Knapsack Problem Greedy Algorithms Example Coin

More information

A difficult problem. ! Given: A set of N cities and $M for gas. Problem: Does a traveling salesperson have enough $ for gas to visit all the cities?

A difficult problem. ! Given: A set of N cities and $M for gas. Problem: Does a traveling salesperson have enough $ for gas to visit all the cities? Intractability A difficult problem Traveling salesperson problem (TSP) Given: A set of N cities and $M for gas. Problem: Does a traveling salesperson have enough $ for gas to visit all the cities? An algorithm

More information

Complexity, P and NP

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

More information