# Reductions. designing algorithms proving limits classifying problems NP-completeness

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Reductions designing algorithms proving limits classifying problems NP-completeness 1

2 Bird s-eye view Desiderata. Classify problems according to their computational requirements. Frustrating news. Huge number of fundamental problems have defied classification Desiderata'. Suppose we could (couldn't) solve problem X efficiently. What else could (couldn't) we solve efficiently? Give me a lever long enough and a fulcrum on which to place it, and I shall move the world. -Archimedes 2

3 Reduction Def. Problem X reduces to problem Y if you can use an algorithm that solves Y to help solve X instance I (of X) Algorithm for Y solution to I Algorithm for X Ex. Euclidean MST reduces to Voronoi. To solve Euclidean MST on N points solve Voronoi for those points construct graph with linear number of edges use Prim/Kruskal to find MST in time proportional to N log N 3

4 Reduction Def. Problem X reduces to problem Y if you can use an algorithm that solves Y to help solve X Cost of solving X = M*(cost of solving Y) + cost of reduction. number of times Y is used Applications designing algorithms: given algorithm for Y, can also solve X. proving limits: if X is hard, then so is Y. classifying problems: establish relative difficulty of problems. 4

5 designing algorithms proving limits classifying problems NP-completeness 5

6 Reductions for algorithm design Def. Problem X reduces to problem Y if you can use an algorithm that solves Y to help solve X Cost of solving X = M*(cost of solving Y) + cost of reduction. number of times Y is used Applications. designing algorithms: given algorithm for Y, can also solve X. proving limits: if X is hard, then so is Y. classifying problems: establish relative difficulty of problems. Mentality: Since I know how to solve Y, can I use that algorithm to solve X? Programmer s version: I have code for Y. Can I use it for X? 6

7 Reductions for algorithm design: convex hull Sorting. Given N distinct integers, rearrange them in ascending order. Convex hull. Given N points in the plane, identify the extreme points of the convex hull (in counter-clockwise order). Claim. Convex hull reduces to sorting. Pf. Graham scan algorithm convex hull sorting Cost of convex hull = cost of sort + cost of reduction linearithmic linear 7

8 Reductions for algorithm design: shortest paths Claim. Shortest paths reduces to path search in graphs (PFS) s Pf. Dijkstra s algorithm 7 44 t w S v s Cost of shortest paths = cost of search + cost of reduction linear length of path 8

9 Reductions for algorithm design: maxflow Claim: Maxflow reduces to PFS (!) A forward edge is an edge in the same direction of the flow An backward edge is an edge in the opposite direction of the flow An augmenting path is along which we can increase flow by adding flow on a forward edge or decreasing flow on a backward edge Theorem [Ford-Fulkerson] To find maxflow: increase flow along any augmenting path continue until no augmenting path can be found Reduction is not linear because it requires multiple calls to PFS 9

10 Reductions for algorithm design: maxflow (continued) Two augmenting-path sequences s s s s t t t t s s s back edge (remove flow) t t t Cost of maxflow = M*(cost of PFS) + cost of reduction linear linear depends on path choice! 10

11 Reductions for algorithm design: bipartite matching Bipartite matching reduces to maxflow A B C D E F Proof: construct new vertices s and t add edges from s to each vertex in one set add edges from each vertex in other set to t set all edge weights to 1 find maxflow in resulting network matching is edges between two sets s A B C D E F t Note: Need to establish that maxflow solution has all integer (0-1) values. 11

12 Reductions for algorithm design: bipartite matching Bipartite matching reduces to maxflow A B C D E F Proof: construct new vertices s and t add edges from s to each vertex in one set add edges from each vertex in other set to t set all edge weights to 1 find maxflow in resulting network matching is edges between two sets s A B C D E F t Note: Need to establish that maxflow solution has all integer (0-1) values. A B C D E F Cost of matching = cost of maxflow + cost of reduction linear 12

13 Reductions for algorithm design: summary Some reductions we have seen so far: bipartite matching PFS arbitrage median finding convex hull maxflow shortest paths shortest paths (neg weights) element distinctness sorting closest pair Euclidean MST LP Voronoi LP (standard form) 13

14 Reductions for algorithm design: a caveat PRIME. Given an integer x (represented in binary), is x prime? COMPOSITE. Given an integer x, does x have a nontrivial factor? PRIME reduces to COMPOSITE public static boolean isprime(biginteger x) { if (iscomposite(x)) return false; else return true; } PRIME COMPOSITE reduces to PRIME public static boolean iscomposite(biginteger x) { if (isprime(x)) return false; else return true; } COMPOSITE A possible real-world scenario: System designer specs the interfaces for project. Programmer A implements iscomposite() using isprime(). Programmer B implements isprime() using iscomposite(). Infinite reduction loop! 14 whose fault?

15 designing algorithms proving limits classifying problems polynomial-time reductions NP-completeness 15

16 Linear-time reductions to prove limits Def. Problem X linear reduces to problem Y if X can be solved with: linear number of standard computational steps for reduction one call to subroutine for Y. Applications. designing algorithms: given algorithm for Y, can also solve X. proving limits: if X is hard, then so is Y. classifying problems: establish relative difficulty of problems. Mentality: If I could easily solve Y, then I could easily solve X I can t easily solve X. Therefore, I can t easily solve Y Purpose of reduction is to establish that Y is hard NOT intended for use as an algorithm 16

17 Proving limits on convex-hull algorithms Lower bound on sorting: Sorting N integers requires (N log N) steps. need quadratic decision tree model of computation that allows tests of the form x i < x j or (x j - x i ) (y k - y i ) - (y j - y i ) (x k - x i ) < 0 Claim. SORTING reduces to CONVEX HULL [see next slide]. Consequence. Any ccw-based convex hull algorithm requires (N log N) steps sorting convex hull 17

18 Sorting linear-reduces to convex hull Sorting instance. Convex hull instance. X = { x 1, x 2,..., x N } P = { (x 1, x 1 2 ), (x 2, x 2 2 ),..., (x N, x N 2 ) } f(x) = x 2 (x 1, x 1 2 ) (x 2, x 2 2 ) Observation. Region {x : x 2 x} is convex all points are on hull. Consequence. Starting at point with most negative x, counter-clockwise order of hull points yields items in ascending order. To sort X, find the convex hull of P. 18

19 3-SUM reduces to 3-COLLINEAR 3-SUM. Given N distinct integers, are there three that sum to 0? 3-COLLINEAR. Given N distinct points in the plane, are there 3 that all lie on the same line? Claim. 3-SUM reduces to 3-COLLINEAR. recall Assignment 2 see next two slides Conjecture. Any algorithm for 3-SUM requires (N 2 ) time. Consequence. Sub-quadratic algorithm for 3-COLLINEAR unlikely. your N 2 log N algorithm from Assignment 2 was pretty good 19

20 3-SUM reduces to 3-COLLINEAR (continued) Claim. 3-SUM L 3-COLLINEAR. 3-SUM instance: 3-COLLINEAR instance: x 1, x 2,..., x N (x 1, x 1 ), (x 2, x 2 ),..., (x N, x N ) f(x) = x 3 Lemma. If a, b, and c are distinct, then a + b + c = 0 if and only if (a, a 3 ), (b, b 3 ), (c, c 3 ) are collinear. (2, 8) (1, 1) Pf. [see next slide] (-3, -27) = 0 20

21 3-SUM reduces to 3-COLLINEAR (continued) Lemma. If a, b, and c are distinct, then a + b + c = 0 if and only if (a, a 3 ), (b, b 3 ), (c, c 3 ) are collinear. Pf. Three points (a, a 3 ), (b, b 3 ), (c, c 3 ) are collinear iff: (a 3 - b 3 ) / (a - b) = (b 3 - c 3 ) / (b - c) (a - b)(a 2 + ab + b 2 ) / (a - b) = (b - c)(b 2 + bc + c 2 ) / (b - c) (a 2 + ab + b 2 ) = (b 2 + bc + c 2 ) a 2 + ab - bc - c 2 = 0 (a - c)(a + b + c) = 0 a + b + c = 0 slopes are equal factor numerators a-b and b-c are nonzero collect terms factor a-c is nonzero 21

22 Reductions for proving limits: summary Establishing limits through reduction is an important tool in guiding algorithm design efforts sorting convex hull Want to be convinced that no linear-time convex hull alg exists? Hard way: long futile search for a linear-time algorithm Easy way: reduction from sorting 3-SUM 3-COLLINEAR Want to be convinced that no subquadratic 3-COLLINEAR alg exists? Hard way: long futile search for a subquadratic algorithm Easy way: reduction from 3-SUM 22

23 designing algorithms proving limits classifying problems NP-completeness 23

24 Reductions to classify problems Def. Problem X linear reduces to problem Y if X can be solved with: Linear number of standard computational steps. One call to subroutine for Y. Applications. Design algorithms: given algorithm for Y, can also solve X. Establish intractability: if X is hard, then so is Y. Classify problems: establish relative difficulty between two problems. Ex: Sorting linear-reduces to convex hull. Convex hull linear-reduces to sorting. Thus, sorting and convex hull are equivalent sorting convex hull not a loop because this reduction is not intended to give a sorting algorithm Most often used to classify problems as either tractable (solvable in polynomial time) intractable (exponential time seems to be required) 24

25 Polynomial-time reductions Def. Problem X polynomial reduces to problem Y if arbitrary instances of problem X can be solved using: Polynomial number of standard computational steps for reduction One call to subroutine for Y. critical detail (not obvious why) Notation. X P Y. Ex. Any linear reduction is a polynomial reduction. Ex. All algorithms for which we know poly-time algorithms poly-time reduce to one another. Poly-time reduction of X to Y makes sense only when X or Y is not known to have a poly-time algorithm 25

26 Polynomial-time reductions for classifying problems Goal. Classify and separate problems according to relative difficulty. tractable problems: can be solved in polynomial time. intractable problems: seem to require exponential time. Establish tractability. If X P Y and Y is tractable then so is X. Solve Y in polynomial time. Use reduction to solve X. Establish intractability. If Y P X and Y is intractable, then so is X. Suppose X can be solved in polynomial time. Then so could Y (through reduction). Contradiction. Therefore X is intractable. Transitivity. If X P Y and Y P Z then X P Z. Ex: all problems that reduce to LP are tractable 26

27 3-satisfiability Literal: A Boolean variable or its negation. x i or x i Clause. A disjunction of 3 distinct literals. C j = (x 1 x 2 x 3 ) Conjunctive normal form. A propositional formula that is the conjunction of clauses. CNF = (C 1 C 2 C 3 C 4 ) 3-SAT. Given a CNF formula consisting of k clauses over n literals, does it have a satisfying truth assignment? yes instance ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) ( x 1 x 2 x 4 ) ( x 2 x 3 x 4 ) x 1 x 2 x 3 x 4 T T F T ( T T F ) (T T F ) ( T T F ) ( T T T) ( T F T) no instance ( x 1 x 2 x 3 ) (x 1 x 2 x 3 ) ( x 1 x 2 x 3 ) ( x 1 x 2 x 4 ) ( x 2 x 3 x 4 ) Applications: Circuit design, program correctness, [many others] 27

28 3-satisfiability is intractable Good news: easy algorithm to solve 3-SAT [ check all possible solutions ] Bad news: running time is exponential in input size. [ there are 2 n possible solutions ] Worse news: no algorithm that guarantees subexponential running time is known Implication: suppose 3-SAT poly-reduces to a problem A poly-time algorithm for A would imply poly-time 3-SAT algorithm we suspect that no poly-time algorithm exists for A! Want to be convinced that a new problem is intractable? Hard way: long futile search for an efficient algorithm (as for 3-SAT) Easy way: reduction from a known intractable problem (such as 3-SAT) hence, intricate reductions are common 28

29 Graph 3-colorability 3-COLOR. Given a graph, is there a way to color the vertices red, green, and blue so that no adjacent vertices have the same color? yes instance 29

30 Graph 3-colorability 3-COLOR. Given a graph, is there a way to color the vertices red, green, and blue so that no adjacent vertices have the same color? yes instance 30

31 Graph 3-colorability 3-COLOR. Given a graph, is there a way to color the vertices red, green, and blue so that no adjacent vertices have the same color? no instance 31

32 3-satisfiability reduces to graph 3-colorability Claim. 3-SAT P 3-COLOR. Pf. Given 3-SAT instance, we construct an instance of 3-COLOR that is 3-colorable if and only if is satisfiable. Construction. (i) Create one vertex for each literal and 3 vertices F T B (ii) Connect F T B in a triangle and connect each literal to B. B (iii) Connect each literal to its negation. (iv) For each clause, attach a 6-vertex gadget [details to follow]. false F true T B base x 1 x 1 x 2 x 2 x 3 x 3... x n x n 32

33 3-satisfiability reduces to graph 3-colorability Claim. If graph is 3-colorable then is satisfiable.. Pf. Consider assignment where F corresponds to false and T to true. (ii) [triangle] ensures each literal is true or false. false F true T B base x 1 x 1 x 2 x 2 x 3 x 3... x n x n 33

34 3-satisfiability reduces to graph 3-colorability Claim. If graph is 3-colorable then is satisfiable.. Pf. Suppose graph is 3-colorable. Consider assignment where F corresponds to false and T to true. (ii) [triangle] ensures each literal is true or false. (iii) ensures a literal and its negation are opposites. false F true T B base x 1 x 1 x 2 x 2 x 3 x 3... x n x n 34

35 3-satisfiability reduces to graph 3-colorability Claim. If graph is 3-colorable then is satisfiable. Pf. Consider assignment where F corresponds to false and T to true. (ii) [triangle] ensures each literal is true or false. (iii) ensures a literal and its negation are opposites. (iv) [gadget] ensures at least one literal in each clause is true. stay tuned (x 1 x 2 x 3 ) B x 1 x 2 x 3 6-node gadget true T F false 35

36 3-satisfiability reduces to graph 3-colorability Claim. If graph is 3-colorable then is satisfiable. Pf. Consider assignment where F corresponds to false and F to true. (ii) [triangle] ensures each literal is true or false. (iii) ensures a literal and its negation are opposites. (iv) [gadget] ensures at least one literal in each clause is true. Therefore, is satisfiable. (x 1 x 2 x 3 ) B x 1 x 2 x 3 6-node gadget true T?? F false 36

37 3-satisfiability reduces to graph 3-colorability Claim. If is satisfiable then graph is 3-colorable. at least one in each clause Pf. Color nodes corresponding to false literals T and to true literals F. (x 1 x 2 x 3 ) x 1 x 2 x 3 37

38 3-satisfiability reduces to graph 3-colorability Claim. If is satisfiable then graph is 3-colorable. Pf. Color nodes corresponding to false literals T and to true literals F. Color vertex below one T vertex F, and vertex below that B. x 1 x 2 x 3 T 38

39 3-satisfiability reduces to graph 3-colorability Claim. If is satisfiable then graph is 3-colorable. Pf. Color nodes corresponding to false literals T and to true literals F. Color vertex below one T vertex F, and vertex below that B. Color remaining middle row vertices B. (x 1 x 2 x 3 ) x 1 x 2 x 3 T 39

40 3-satisfiability reduces to graph 3-colorability Claim. If is satisfiable then graph is 3-colorable. Pf. Color nodes corresponding to false literals T and to true literals F. Color vertex below one T vertex F, and vertex below that B. Color remaining middle row vertices B. Color remaining bottom vertices T or F as forced. Works for all gadgets, so graph is 3-colorable. (x 1 x 2 x 3 ) x 1 x 2 x 3 40

41 3-satisfiability reduces to graph 3-colorability Claim. 3-SAT P 3-COLOR. Pf. Given 3-SAT instance, we construct an instance of 3-COLOR that is 3-colorable if and only if is satisfiable. Construction. (i) Create one vertex for each literal. (ii) Create 3 new vertices T, F, and B; connect them in a triangle, and connect each literal to B. (iii) Connect each literal to its negation. (iv) For each clause, attach a gadget of 6 vertices and 13 edges Conjecture: No polynomial-time algorithm for 3-SAT Implication: No polynomial-time algorithm for 3-COLOR. Reminder Construction is not intended for use, just to prove 3-COLOR difficult 41

42 designing algorithms proving limits classifying problems polynomial-time reductions NP-completeness 42

43 More Poly-Time Reductions 3-SAT reduces to 3-COLOR 3-SAT 3-COLOR 3DM VERTEX COVER Dick Karp '85 Turing award EXACT COVER PLANAR-3-COLOR CLIQUE HAM-CYCLE SUBSET-SUM INDEPENDENT SET TSP HAM-PATH PARTITION INTEGER PROGRAMMING KNAPSACK BIN-PACKING Conjecture: no poly-time algorithm for 3-SAT. (and hence none of these problems) 43

44 Cook s Theorem NP: set of problems solvable in polynomial time by a nondeterministic Turing machine THM. Any problem in NP P 3-SAT. Pf sketch. Each problem P in NP corresponds to a TM M that accepts or rejects any input in time polynomial in its size Given M and a problem instance I, construct an instance of 3-SAT that is satisfiable iff the machine accepts I. Construction. Variables for every tape cell, head position, and state at every step. Clauses corresponding to each transition. [many details omitted] 44

45 Implications of Cook s theorem 3-COLOR reduces to 3-SAT 3-SAT 3-COLOR 3DM VERTEX COVER Stephen Cook '82 Turing award EXACT COVER PLANAR-3-COLOR CLIQUE HAM-CYCLE SUBSET-SUM INDEPENDENT SET TSP HAM-PATH PARTITION INTEGER PROGRAMMING KNAPSACK BIN-PACKING All of these problems (any many more) polynomial reduce to 3-SAT. 45

46 Implications of Karp + Cook All of these problems poly-reduce to one another! 3-COLOR 3-COLOR reduces to 3-SAT 3-SAT reduces to 3-COLOR 3-SAT 3DM VERTEX COVER EXACT COVER PLANAR-3-COLOR CLIQUE HAM-CYCLE SUBSET-SUM INDEPENDENT SET TSP HAM-PATH PARTITION INTEGER PROGRAMMING KNAPSACK BIN-PACKING Conjecture: no poly-time algorithm for 3-SAT. (and hence none of these problems) 46

47 Poly-Time Reductions: Implications 47

48 Poly-Time Reductions: Implications 48

49 Poly-Time Reductions: Implications 49

50 Summary Reductions are important in theory to: Establish tractability. Establish intractability. Classify problems according to their computational requirements. Reductions are important in practice to: Design algorithms. Design reusable software modules. stack, queue, sorting, priority queue, symbol table, set, graph shortest path, regular expressions, linear programming Determine difficulty of your problem and choose the right tool. use exact algorithm for tractable problems use heuristics for intractable problems 50

### CSC 373: Algorithm Design and Analysis Lecture 16

CSC 373: Algorithm Design and Analysis Lecture 16 Allan Borodin February 25, 2013 Some materials are from Stephen Cook s IIT talk and Keven Wayne s slides. 1 / 17 Announcements and Outline Announcements

### Page 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. P, NP, and NP-Complete. Polynomial-Time Algorithms

CSCE 310J Data Structures & Algorithms P, NP, and NP-Complete Dr. Steve Goddard goddard@cse.unl.edu CSCE 310J Data Structures & Algorithms Giving credit where credit is due:» Most of the lecture notes

### Lecture 7: NP-Complete Problems

IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Basic Course on Computational Complexity Lecture 7: NP-Complete Problems David Mix Barrington and Alexis Maciel July 25, 2000 1. Circuit

### Introduction to Logic in Computer Science: Autumn 2006

Introduction to Logic in Computer Science: Autumn 2006 Ulle Endriss Institute for Logic, Language and Computation University of Amsterdam Ulle Endriss 1 Plan for Today Now that we have a basic understanding

### 1. Nondeterministically guess a solution (called a certificate) 2. Check whether the solution solves the problem (called verification)

Some N P problems Computer scientists have studied many N P problems, that is, problems that can be solved nondeterministically in polynomial time. Traditionally complexity question are studied as languages:

### ! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

Approximation Algorithms 11 Approximation Algorithms Q Suppose I need to solve an NP-hard problem What should I do? A Theory says you're unlikely to find a poly-time algorithm Must sacrifice one of three

### 2.3 Scheduling jobs on identical parallel machines

2.3 Scheduling jobs on identical parallel machines There are jobs to be processed, and there are identical machines (running in parallel) to which each job may be assigned Each job = 1,,, must be processed

### ! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

Approximation Algorithms Chapter Approximation Algorithms Q Suppose I need to solve an NP-hard problem What should I do? A Theory says you're unlikely to find a poly-time algorithm Must sacrifice one of

Approximation Algorithms Chapter Approximation Algorithms Q. Suppose I need to solve an NP-hard problem. What should I do? A. Theory says you're unlikely to find a poly-time algorithm. Must sacrifice one

### OHJ-2306 Introduction to Theoretical Computer Science, Fall 2012 8.11.2012

276 The P vs. NP problem is a major unsolved problem in computer science It is one of the seven Millennium Prize Problems selected by the Clay Mathematics Institute to carry a \$ 1,000,000 prize for the

### COMS4236: Introduction to Computational Complexity. Summer 2014

COMS4236: Introduction to Computational Complexity Summer 2014 Mihalis Yannakakis Lecture 17 Outline conp NP conp Factoring Total NP Search Problems Class conp Definition of NP is nonsymmetric with respect

### SIMS 255 Foundations of Software Design. Complexity and NP-completeness

SIMS 255 Foundations of Software Design Complexity and NP-completeness Matt Welsh November 29, 2001 mdw@cs.berkeley.edu 1 Outline Complexity of algorithms Space and time complexity ``Big O'' notation Complexity

### Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

Outline NP-completeness Examples of Easy vs. Hard problems Euler circuit vs. Hamiltonian circuit Shortest Path vs. Longest Path 2-pairs sum vs. general Subset Sum Reducing one problem to another Clique

### Guessing Game: NP-Complete?

Guessing Game: NP-Complete? 1. LONGEST-PATH: Given a graph G = (V, E), does there exists a simple path of length at least k edges? YES 2. SHORTEST-PATH: Given a graph G = (V, E), does there exists a simple

### Why? A central concept in Computer Science. Algorithms are ubiquitous.

Analysis of Algorithms: A Brief Introduction Why? A central concept in Computer Science. Algorithms are ubiquitous. Using the Internet (sending email, transferring files, use of search engines, online

### Introduction to Algorithms. Part 3: P, NP Hard Problems

Introduction to Algorithms Part 3: P, NP Hard Problems 1) Polynomial Time: P and NP 2) NP-Completeness 3) Dealing with Hard Problems 4) Lower Bounds 5) Books c Wayne Goddard, Clemson University, 2004 Chapter

### Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li

Computer Algorithms NP-Complete Problems NP-completeness The quest for efficient algorithms is about finding clever ways to bypass the process of exhaustive search, using clues from the input in order

### A Working Knowledge of Computational Complexity for an Optimizer

A Working Knowledge of Computational Complexity for an Optimizer ORF 363/COS 323 Instructor: Amir Ali Ahmadi TAs: Y. Chen, G. Hall, J. Ye Fall 2014 1 Why computational complexity? What is computational

### Complexity Theory. IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar

Complexity Theory IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar Outline Goals Computation of Problems Concepts and Definitions Complexity Classes and Problems Polynomial Time Reductions Examples

### Approximation Algorithms: LP Relaxation, Rounding, and Randomized Rounding Techniques. My T. Thai

Approximation Algorithms: LP Relaxation, Rounding, and Randomized Rounding Techniques My T. Thai 1 Overview An overview of LP relaxation and rounding method is as follows: 1. Formulate an optimization

### Introduction to Algorithms Review information for Prelim 1 CS 4820, Spring 2010 Distributed Wednesday, February 24

Introduction to Algorithms Review information for Prelim 1 CS 4820, Spring 2010 Distributed Wednesday, February 24 The final exam will cover seven topics. 1. greedy algorithms 2. divide-and-conquer algorithms

### NP-Completeness and Cook s Theorem

NP-Completeness and Cook s Theorem Lecture notes for COM3412 Logic and Computation 15th January 2002 1 NP decision problems The decision problem D L for a formal language L Σ is the computational task:

### Near Optimal Solutions

Near Optimal Solutions Many important optimization problems are lacking efficient solutions. NP-Complete problems unlikely to have polynomial time solutions. Good heuristics important for such problems.

### Introduction to NP-Completeness Written and copyright c by Jie Wang 1

91.502 Foundations of Comuter Science 1 Introduction to Written and coyright c by Jie Wang 1 We use time-bounded (deterministic and nondeterministic) Turing machines to study comutational comlexity of

### Approximation Algorithms

Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NP-Completeness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms

### The Classes P and NP

The Classes P and NP We now shift gears slightly and restrict our attention to the examination of two families of problems which are very important to computer scientists. These families constitute the

### NP-Completeness I. Lecture 19. 19.1 Overview. 19.2 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

### ! X is a set of strings. ! Instance: string s. ! Algorithm A solves problem X: A(s) = yes iff s! X.

Decision Problems 8.2 Definition of NP Decision problem. X is a set of strings. Instance: string s. Algorithm A solves problem X: A(s) = yes iff s X. Polynomial time. Algorithm A runs in polytime if for

### Theoretical Computer Science (Bridging Course) Complexity

Theoretical Computer Science (Bridging Course) Complexity Gian Diego Tipaldi A scenario You are a programmer working for a logistics company Your boss asks you to implement a program that optimizes the

### P versus NP, and More

1 P versus NP, and More Great Ideas in Theoretical Computer Science Saarland University, Summer 2014 If you have tried to solve a crossword puzzle, you know that it is much harder to solve it than to verify

### Applied Algorithm Design Lecture 5

Applied Algorithm Design Lecture 5 Pietro Michiardi Eurecom Pietro Michiardi (Eurecom) Applied Algorithm Design Lecture 5 1 / 86 Approximation Algorithms Pietro Michiardi (Eurecom) Applied Algorithm Design

### Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras

Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture No. # 31 Recursive Sets, Recursively Innumerable Sets, Encoding

### Complexity Classes P and NP

Complexity Classes P and NP MATH 3220 Supplemental Presentation by John Aleshunas The cure for boredom is curiosity. There is no cure for curiosity Dorothy Parker Computational Complexity Theory In computer

### Chapter. NP-Completeness. Contents

Chapter 13 NP-Completeness Contents 13.1 P and NP......................... 593 13.1.1 Defining the Complexity Classes P and NP...594 13.1.2 Some Interesting Problems in NP.......... 597 13.2 NP-Completeness....................

### princeton univ. F 13 cos 521: Advanced Algorithm Design Lecture 6: Provable Approximation via Linear Programming Lecturer: Sanjeev Arora

princeton univ. F 13 cos 521: Advanced Algorithm Design Lecture 6: Provable Approximation via Linear Programming Lecturer: Sanjeev Arora Scribe: One of the running themes in this course is the notion of

### Notes on NP Completeness

Notes on NP Completeness Rich Schwartz November 10, 2013 1 Overview Here are some notes which I wrote to try to understand what NP completeness means. Most of these notes are taken from Appendix B in Douglas

### Optimal Binary Space Partitions in the Plane

Optimal Binary Space Partitions in the Plane Mark de Berg and Amirali Khosravi TU Eindhoven, P.O. Box 513, 5600 MB Eindhoven, the Netherlands Abstract. An optimal bsp for a set S of disjoint line segments

### NP-complete? NP-hard? Some Foundations of Complexity. Prof. Sven Hartmann Clausthal University of Technology Department of Informatics

NP-complete? NP-hard? Some Foundations of Complexity Prof. Sven Hartmann Clausthal University of Technology Department of Informatics Tractability of Problems Some problems are undecidable: no computer

### On the Relationship between Classes P and NP

Journal of Computer Science 8 (7): 1036-1040, 2012 ISSN 1549-3636 2012 Science Publications On the Relationship between Classes P and NP Anatoly D. Plotnikov Department of Computer Systems and Networks,

### Algorithm Design and Analysis

Algorithm Design and Analysis LECTURE 27 Approximation Algorithms Load Balancing Weighted Vertex Cover Reminder: Fill out SRTEs online Don t forget to click submit Sofya Raskhodnikova 12/6/2011 S. Raskhodnikova;

### Lattice Point Geometry: Pick s Theorem and Minkowski s Theorem. Senior Exercise in Mathematics. Jennifer Garbett Kenyon College

Lattice Point Geometry: Pick s Theorem and Minkowski s Theorem Senior Exercise in Mathematics Jennifer Garbett Kenyon College November 18, 010 Contents 1 Introduction 1 Primitive Lattice Triangles 5.1

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

### Homework Exam 1, Geometric Algorithms, 2016

Homework Exam 1, Geometric Algorithms, 2016 1. (3 points) Let P be a convex polyhedron in 3-dimensional space. The boundary of P is represented as a DCEL, storing the incidence relationships between the

### 8 Primes and Modular Arithmetic

8 Primes and Modular Arithmetic 8.1 Primes and Factors Over two millennia ago already, people all over the world were considering the properties of numbers. One of the simplest concepts is prime numbers.

### Tetris is Hard: An Introduction to P vs NP

Tetris is Hard: An Introduction to P vs NP Based on Tetris is Hard, Even to Approximate in COCOON 2003 by Erik D. Demaine (MIT) Susan Hohenberger (JHU) David Liben-Nowell (Carleton) What s Your Problem?

### Reductions & NP-completeness as part of Foundations of Computer Science undergraduate course

Reductions & NP-completeness as part of Foundations of Computer Science undergraduate course Alex Angelopoulos, NTUA January 22, 2015 Outline Alex Angelopoulos (NTUA) FoCS: Reductions & NP-completeness-

### MATH10040 Chapter 2: Prime and relatively prime numbers

MATH10040 Chapter 2: Prime and relatively prime numbers Recall the basic definition: 1. Prime numbers Definition 1.1. Recall that a positive integer is said to be prime if it has precisely two positive

### Tutorial 8. NP-Complete Problems

Tutorial 8 NP-Complete Problems Decision Problem Statement of a decision problem Part 1: instance description defining the input Part 2: question stating the actual yesor-no question A decision problem

### Notes on Complexity Theory Last updated: August, 2011. Lecture 1

Notes on Complexity Theory Last updated: August, 2011 Jonathan Katz Lecture 1 1 Turing Machines I assume that most students have encountered Turing machines before. (Students who have not may want to look

### Satisfiability Checking

Satisfiability Checking SAT-Solving Prof. Dr. Erika Ábrahám Theory of Hybrid Systems Informatik 2 WS 10/11 Prof. Dr. Erika Ábrahám - Satisfiability Checking 1 / 40 A basic SAT algorithm Assume the CNF

### Welcome to... Problem Analysis and Complexity Theory 716.054, 3 VU

Welcome to... Problem Analysis and Complexity Theory 716.054, 3 VU Birgit Vogtenhuber Institute for Software Technology email: bvogt@ist.tugraz.at office hour: Tuesday 10:30 11:30 slides: http://www.ist.tugraz.at/pact.html

### CS268: Geometric Algorithms Handout #5 Design and Analysis Original Handout #15 Stanford University Tuesday, 25 February 1992

CS268: Geometric Algorithms Handout #5 Design and Analysis Original Handout #15 Stanford University Tuesday, 25 February 1992 Original Lecture #6: 28 January 1991 Topics: Triangulating Simple Polygons

### One last point: we started off this book by introducing another famously hard search problem:

S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani 261 Factoring One last point: we started off this book by introducing another famously hard search problem: FACTORING, the task of finding all prime factors

### Exponential time algorithms for graph coloring

Exponential time algorithms for graph coloring Uriel Feige Lecture notes, March 14, 2011 1 Introduction Let [n] denote the set {1,..., k}. A k-labeling of vertices of a graph G(V, E) is a function V [k].

### Why Study NP- hardness. NP Hardness/Completeness Overview. P and NP. Scaling 9/3/13. Ron Parr CPS 570. NP hardness is not an AI topic

Why Study NP- hardness NP Hardness/Completeness Overview Ron Parr CPS 570 NP hardness is not an AI topic It s important for all computer scienhsts Understanding it will deepen your understanding of AI

### R u t c o r Research R e p o r t. Boolean functions with a simple certificate for CNF complexity. Ondřej Čepeka Petr Kučera b Petr Savický c

R u t c o r Research R e p o r t Boolean functions with a simple certificate for CNF complexity Ondřej Čepeka Petr Kučera b Petr Savický c RRR 2-2010, January 24, 2010 RUTCOR Rutgers Center for Operations

### Solutions to Exercises 8

Discrete Mathematics Lent 2009 MA210 Solutions to Exercises 8 (1) Suppose that G is a graph in which every vertex has degree at least k, where k 1, and in which every cycle contains at least 4 vertices.

### 11. APPROXIMATION ALGORITHMS

11. APPROXIMATION ALGORITHMS load balancing center selection pricing method: vertex cover LP rounding: vertex cover generalized load balancing knapsack problem Lecture slides by Kevin Wayne Copyright 2005

### CAD Algorithms. P and NP

CAD Algorithms The Classes P and NP Mohammad Tehranipoor ECE Department 6 September 2010 1 P and NP P and NP are two families of problems. P is a class which contains all of the problems we solve using

### Lecture 2: Universality

CS 710: Complexity Theory 1/21/2010 Lecture 2: Universality Instructor: Dieter van Melkebeek Scribe: Tyson Williams In this lecture, we introduce the notion of a universal machine, develop efficient universal

### Generating models of a matched formula with a polynomial delay

Generating models of a matched formula with a polynomial delay Petr Savicky Institute of Computer Science, Academy of Sciences of Czech Republic, Pod Vodárenskou Věží 2, 182 07 Praha 8, Czech Republic

### Planar Graph and Trees

Dr. Nahid Sultana December 16, 2012 Tree Spanning Trees Minimum Spanning Trees Maps and Regions Eulers Formula Nonplanar graph Dual Maps and the Four Color Theorem Tree Spanning Trees Minimum Spanning

### Fall 2015 Midterm 1 24/09/15 Time Limit: 80 Minutes

Math 340 Fall 2015 Midterm 1 24/09/15 Time Limit: 80 Minutes Name (Print): This exam contains 6 pages (including this cover page) and 5 problems. Enter all requested information on the top of this page,

### Discuss the size of the instance for the minimum spanning tree problem.

3.1 Algorithm complexity The algorithms A, B are given. The former has complexity O(n 2 ), the latter O(2 n ), where n is the size of the instance. Let n A 0 be the size of the largest instance that can

### Lecture 19: Introduction to NP-Completeness Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY 11794 4400

Lecture 19: Introduction to NP-Completeness Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Reporting to the Boss Suppose

### CMSC 451: Graph Properties, DFS, BFS, etc.

CMSC 451: Graph Properties, DFS, BFS, etc. Slides By: Carl Kingsford Department of Computer Science University of Maryland, College Park Based on Chapter 3 of Algorithm Design by Kleinberg & Tardos. Graphs

### ON THE COMPLEXITY OF THE GAME OF SET. {kamalika,pbg,dratajcz,hoeteck}@cs.berkeley.edu

ON THE COMPLEXITY OF THE GAME OF SET KAMALIKA CHAUDHURI, BRIGHTEN GODFREY, DAVID RATAJCZAK, AND HOETECK WEE {kamalika,pbg,dratajcz,hoeteck}@cs.berkeley.edu ABSTRACT. Set R is a card game played with a

Mathematics 0N1 Solutions 1 1. Write the following sets in list form. 1(i) The set of letters in the word banana. {a, b, n}. 1(ii) {x : x 2 + 3x 10 = 0}. 3(iv) C A. True 3(v) B = {e, e, f, c}. True 3(vi)

### CMPSCI611: Approximating MAX-CUT Lecture 20

CMPSCI611: Approximating MAX-CUT Lecture 20 For the next two lectures we ll be seeing examples of approximation algorithms for interesting NP-hard problems. Today we consider MAX-CUT, which we proved to

### Partitioning edge-coloured complete graphs into monochromatic cycles and paths

arxiv:1205.5492v1 [math.co] 24 May 2012 Partitioning edge-coloured complete graphs into monochromatic cycles and paths Alexey Pokrovskiy Departement of Mathematics, London School of Economics and Political

### Handout #1: Mathematical Reasoning

Math 101 Rumbos Spring 2010 1 Handout #1: Mathematical Reasoning 1 Propositional Logic A proposition is a mathematical statement that it is either true or false; that is, a statement whose certainty or

### CS510 Software Engineering

CS510 Software Engineering Propositional Logic Asst. Prof. Mathias Payer Department of Computer Science Purdue University TA: Scott A. Carr Slides inspired by Xiangyu Zhang http://nebelwelt.net/teaching/15-cs510-se

### Discrete Mathematics Lecture 3 Elementary Number Theory and Methods of Proof. Harper Langston New York University

Discrete Mathematics Lecture 3 Elementary Number Theory and Methods of Proof Harper Langston New York University Proof and Counterexample Discovery and proof Even and odd numbers number n from Z is called

### Informatique Fondamentale IMA S8

Informatique Fondamentale IMA S8 Cours 4 : graphs, problems and algorithms on graphs, (notions of) NP completeness Laure Gonnord http://laure.gonnord.org/pro/teaching/ Laure.Gonnord@polytech-lille.fr Université

### 2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

Code No: R05220502 Set No. 1 1. (a) Describe the performance analysis in detail. (b) Show that f 1 (n)+f 2 (n) = 0(max(g 1 (n), g 2 (n)) where f 1 (n) = 0(g 1 (n)) and f 2 (n) = 0(g 2 (n)). [8+8] 2. (a)

### Foundations of Geometry 1: Points, Lines, Segments, Angles

Chapter 3 Foundations of Geometry 1: Points, Lines, Segments, Angles 3.1 An Introduction to Proof Syllogism: The abstract form is: 1. All A is B. 2. X is A 3. X is B Example: Let s think about an example.

### Divide-and-Conquer. Three main steps : 1. divide; 2. conquer; 3. merge.

Divide-and-Conquer Three main steps : 1. divide; 2. conquer; 3. merge. 1 Let I denote the (sub)problem instance and S be its solution. The divide-and-conquer strategy can be described as follows. Procedure

### 10. Graph Matrices Incidence Matrix

10 Graph Matrices Since a graph is completely determined by specifying either its adjacency structure or its incidence structure, these specifications provide far more efficient ways of representing a

### Notes on Complexity Theory Last updated: August, 2011. Lecture 1

Notes on Complexity Theory Last updated: August, 2011 Jonathan Katz Lecture 1 1 Turing Machines I assume that most students have encountered Turing machines before. (Students who have not may want to look

### Graphs without proper subgraphs of minimum degree 3 and short cycles

Graphs without proper subgraphs of minimum degree 3 and short cycles Lothar Narins, Alexey Pokrovskiy, Tibor Szabó Department of Mathematics, Freie Universität, Berlin, Germany. August 22, 2014 Abstract

### Counting Falsifying Assignments of a 2-CF via Recurrence Equations

Counting Falsifying Assignments of a 2-CF via Recurrence Equations Guillermo De Ita Luna, J. Raymundo Marcial Romero, Fernando Zacarias Flores, Meliza Contreras González and Pedro Bello López Abstract

### Discrete Mathematics Problems

Discrete Mathematics Problems William F. Klostermeyer School of Computing University of North Florida Jacksonville, FL 32224 E-mail: wkloster@unf.edu Contents 0 Preface 3 1 Logic 5 1.1 Basics...............................

### Chapter I Logic and Proofs

MATH 1130 1 Discrete Structures Chapter I Logic and Proofs Propositions A proposition is a statement that is either true (T) or false (F), but or both. s Propositions: 1. I am a man.. I am taller than

### Algorithms and Data Structures

Algorithm Analysis Page 1 BFH-TI: Softwareschule Schweiz Algorithm Analysis Dr. CAS SD01 Algorithm Analysis Page 2 Outline Course and Textbook Overview Analysis of Algorithm Pseudo-Code and Primitive Operations

### CS311H. Prof: Peter Stone. Department of Computer Science The University of Texas at Austin

CS311H Prof: Department of Computer Science The University of Texas at Austin Good Morning, Colleagues Good Morning, Colleagues Are there any questions? Logistics Class survey Logistics Class survey Homework

### What s next? Reductions other than kernelization

What s next? Reductions other than kernelization Dániel Marx Humboldt-Universität zu Berlin (with help from Fedor Fomin, Daniel Lokshtanov and Saket Saurabh) WorKer 2010: Workshop on Kernelization Nov

### CSC2420 Spring 2015: Lecture 3

CSC2420 Spring 2015: Lecture 3 Allan Borodin January 22, 2015 1 / 1 Announcements and todays agenda Assignment 1 due next Thursday. I may add one or two additional questions today or tomorrow. Todays agenda

### CSE 135: Introduction to Theory of Computation Decidability and Recognizability

CSE 135: Introduction to Theory of Computation Decidability and Recognizability Sungjin Im University of California, Merced 04-28, 30-2014 High-Level Descriptions of Computation Instead of giving a Turing

### Nan Kong, Andrew J. Schaefer. Department of Industrial Engineering, Univeristy of Pittsburgh, PA 15261, USA

A Factor 1 2 Approximation Algorithm for Two-Stage Stochastic Matching Problems Nan Kong, Andrew J. Schaefer Department of Industrial Engineering, Univeristy of Pittsburgh, PA 15261, USA Abstract We introduce

### CSL851: Algorithmic Graph Theory Semester I Lecture 1: July 24

CSL851: Algorithmic Graph Theory Semester I 2013-2014 Lecture 1: July 24 Lecturer: Naveen Garg Scribes: Suyash Roongta Note: LaTeX template courtesy of UC Berkeley EECS dept. Disclaimer: These notes have

### Introduction to computer science

Introduction to computer science Michael A. Nielsen University of Queensland Goals: 1. Introduce the notion of the computational complexity of a problem, and define the major computational complexity classes.

### INCIDENCE-BETWEENNESS GEOMETRY

INCIDENCE-BETWEENNESS GEOMETRY MATH 410, CSUSM. SPRING 2008. PROFESSOR AITKEN This document covers the geometry that can be developed with just the axioms related to incidence and betweenness. The full

### Graph Theory Problems and Solutions

raph Theory Problems and Solutions Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles November, 005 Problems. Prove that the sum of the degrees of the vertices of any finite graph is

### Chapter 1. NP Completeness I. 1.1. Introduction. By Sariel Har-Peled, December 30, 2014 1 Version: 1.05

Chapter 1 NP Completeness I By Sariel Har-Peled, December 30, 2014 1 Version: 1.05 "Then you must begin a reading program immediately so that you man understand the crises of our age," Ignatius said solemnly.

### Notes on Matrix Multiplication and the Transitive Closure

ICS 6D Due: Wednesday, February 25, 2015 Instructor: Sandy Irani Notes on Matrix Multiplication and the Transitive Closure An n m matrix over a set S is an array of elements from S with n rows and m columns.

### Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design

Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design Hongsik Choi and Hyeong-Ah Choi Department of Electrical Engineering and Computer Science George Washington University Washington,

### Continued fractions and good approximations.

Continued fractions and good approximations We will study how to find good approximations for important real life constants A good approximation must be both accurate and easy to use For instance, our