Examples of P vs NP: More Problems

Size: px
Start display at page:

Download "Examples of P vs NP: More Problems"

Transcription

1 Examples of P vs NP: More Problems COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2017

2 Catch Up / Drop in Lab When Fridays, Where N335, CSIT Building (bldg 108) Until the end of the semester This is not a tutorial, but we re happy to answer all your questions. No registration or anything required just drop by! 1 / 41

3 Hamiltonian Paths Given. An undirected Graph G. Decision Problem. is there a path in G that visits each vertex exactly once? Computation Problem. Compute a path in G that visits each vertex exactly once (if it exists) Your Gut Feeling. Easy (polynomial) or hard (NP or worse)? 2 / 41

4 Hamiltonian Paths: Naive Approach Naive Algorithm Given G = (V, E) n possibilities for 1st vertex, n 2 for 2nd, n 3 for third... overall: n! different paths to check Estimate on a machine that does 1,000,000 steps per second simplified: this does not include overhead for moving on Turing tapes size time Q. What is the unit of time in the right-hand column? 3 / 41

5 Hamiltonian Paths: Naive Approach Naive Algorithm Given G = (V, E) n possibilities for 1st vertex, n 2 for 2nd, n 3 for third... overall: n! different paths to check Estimate on a machine that does 1,000,000 steps per second simplified: this does not include overhead for moving on Turing tapes size time Q. What is the unit of time in the right-hand column? A. Millions of years... 3 / 41

6 NP-Approach to Hamiltonian Paths Recall. An NP-problem is a problem that has polytime verifiers for each instance, there exists a polysize certificate that can be checked in polynomial time Q. What counts as certificate for a Hamiltionian Path? 4 / 41

7 NP-Approach to Hamiltonian Paths Recall. An NP-problem is a problem that has polytime verifiers for each instance, there exists a polysize certificate that can be checked in polynomial time Q. What counts as certificate for a Hamiltionian Path? A. Of course the path itself! list of vertices v 1,..., v n Checking of a certificate v 1,..., v n each v i, v i+1 must be an edge there are no duplicates there are exactly n vertices 4 / 41

8 Certificates for Hamiltonian Paths Certificate given a graph G = (V, E) a list v 1,..., v n of vertices Certificate Checking. each two successive entries must be an edge: walk through all edges and compare polytime absence of duplicates: walk though list and check polynomial length of path = number of vertices: counting polytime Difficult Question. If we consider a path as a certificate, how large is this certificate? 5 / 41

9 Hamiltonian Paths: Certificate Size Adjacency Matrix Representation of a graph with n vertices n bitstrings of length n i-th bit in the j-th bitstring = 1: have vertex v i v j Size of Certificate for a graph with n vertices each vertex can be represented using log n bits need n vertices, so n log n bits overall so n 2 bits, i.e. polynomial in the size of the graph Corollary. Checking whether a Hamiltonian Path exists is in NP. 6 / 41

10 Hamiltonian Paths: Certificate Size List Representation of a graph with n vertices number of vertices (in binary): log n bits list of vertices, each vertex 2 log n bits Worst Case. The empty graph with n vertices coded by a binary representation of n log n bits Certificate Size. n log n bits not polynomial in the representation of the graph n log n = 2 k k where k = log n is the size of the graph Observation. coding is important depending on representation, have polynomial or exponential certificates Hamiltonian Path is in NP if an n-vertex graph is represented by n bits (at least) 7 / 41

11 Hamiltonian Path via Dynamic Programming Given. Graph G = (V, E) Idea. Let S V and v S. Then 1. there is a path that visits all vertices in S and ends in v iff 2. v is connected to a vertex w and there is a path that covers all vertices in S \ {v} and ends in w Dynamic Programming. for S V and v V, record existence of cover of S ending in v (yes/no) Start with smallest S/v pairs ({v}, v) successively enlarge S by one element, and use recurrence above Complexity Analysis. number of subset / element pairs: n 2 n in each step, check all neighbours of a vertex n steps Overall Complexity. O(n 2 2 n ) = O(2 n ) 8 / 41

12 Weighted Graphs Definition. A weighted graph is an undirected graph where every edge is (additionally) labelled with a non-negative integer. Formally: A weighted graph is a triple G = (V, E, l) where (V, E) is an undirected graph (with vertices V and edges E) l : E N is a labelling function that assigns a weight (or cost) to each edge. Example. Intuition. the vertices can be locations the edges indicate whether we can travel between two locations the labels indicate the cost of travelling between two locations 9 / 41

13 Travelling Between Two Nodes Q. Given two vertices v 1 and v 2, what is the cheapest way of getting from v 1 to v 2? In More detail. as a computation problem: given vertices v 1 and v 2, find a cheapest path that connects v 1 and v 2 as a decision problem: given graph G and k 0, is there a path that connects vertices v 1 and v 2 of total cost k? Q. Easy or hard? Solvable in polynomial time? 10 / 41

14 Dijkstra s Algorithm Main Idea. to find a shortest path between v 1 and v 2, need to consider intermediate nodes more general problem: shortest path between v 1 and any vertex v 2 a bit like breadth-first search Data Structures. Given a start vertex s cheapest[v]: For every vertex v, the price of the cheapest path from s to v explored[v]: a boolean marker whether v has been explored 11 / 41

15 Algorithm Detail for source vertex s Initialisation. set cheapest[s] = 0, cheapest[v] = undef for v s set explored[v] = false, all v V Iteration. 1. Select a vertex in v that is not explored and minimal: explored[v] = false cheapest[v] cheapest[w] for all w with explored[w] = false 2. for each vertex w that is adjacent to v: update, if the path s v u is cheaper, that is if cheapest[v] + cost(v, w) cheapest[w] then cheapest[w] = cheapest[v] + cost(v, w) 3. mark v as explored: explored[v] = true once a node v is marked explored, cheapest[v] is the price of the cheapest path from source to v 12 / 41

16 Dijkstra s Algorithm: Correctness Invariant. if E is the set of explored nodes, then for e E, cheapest[e] is the cost of cheapest path from source to e for u V \ E, cheapest[u] is the cost of the cheapest path to u that only visits explored nodes. True after Initialisation. trivial, as all nodes are marked as unexplored Invariant holds after every iteration. pick minimal and unexplored node u cheapest path from source to u cannot traverse unexplored nodes after (possible) update: cheapest is still minimal for paths through explored vertices At End of Iteration. cheapest[v] is cost of cheapest path from source to v Recognise the While-Rule in Hoare Logic? could formalise this in Hoare logic here: Hoare-Logic as informal guidance principle 13 / 41

17 Dijkstra s Algorithm: Complexity Worst Case Focus. need to explore all nodes In Every Iteration possibly update cheapest[v], for all vertices v Overall Complexity for a graph with n vertices run through n iterations, in each iteration: find minimal unexplored vertex n steps update cheapest[v] n steps so overall O(n 2 ) steps Low-Level Operations are harmless (polynomial) comparing two n-bit binary numbers marking / checking explored status 14 / 41

18 Shortest Paths Decision Problem. Given G, v 1, v 2 and k 0, is there a path of cost k from v 1 to v 2? run Dijkstra s algorithm and then check whether cheapest[v 2 ] k Computational Problem Given G, v 1 and v 2, find the shortest path from v 1 to v 2 Dijstra s algorithm only gives cost paths needs to be re-constructed idea: remember penultimate nodes 15 / 41

19 Computing Shortest Paths Initialisation. set cheapest[s] = 0, cheapest[v] = undef for v s set explored[v] = false, all v V set penultimate[v] = undef, all v V Iteration. 1. Select a vertex in v that is not explored and minimal: explored[v] = false cheapest[v] cheapest[w] for all w with explored[w] = false 2. for each vertex w that is adjacent to v: update, if the path s v u is cheaper, that is if cheapest[v] + cost(v, w) cheapest[w] then cheapest[w] = cheapest[v] + cost(v, w) and put penultimate[w] = v 3. mark v as explored: explored[v] = true once a node v is marked explored, cheapest[v] is the price of the cheapest path from source to v 16 / 41

20 Path Reconstruction Idea. penultimate[v] is the penultimate node of a cheapest path from source to v Reconstruction of a path from source to v initialisation: the last node is v iteration: path expansion on the left if partial path v1,..., v n is already constructed extend it to penultimate[v 1 ], v 1,..., v n termination: if the constructed path is of the form source,..., v n Complexity. reconstruction phase: at most n additional steps iteration phase: adds constant overhead so overall, still polynomial How About Coding Graphs as Strings? our analysis in terms of number of vertices bounded above by length of encoding 17 / 41

21 Travelling Salesman Problem Given. A weighted undirected graph vertices represent cities edges represent travel time Q. Find a path v 1 v 2 v n v 1 that begins and ends in the same city that visits each city exactly once for which the overal travel time is minimal. Q. Easy or hard? Solvable in Polytime? 18 / 41

22 Travelling Salesman: Naive Approach Naive Algorithm Given n cities, and their distances dist(c, d) initialise: construct set S consisting of all possible sequences of nodes sequences may not have repeated vertices sequences must contain all vertices of the graph computation phase: for each s = (c 1,..., c n ) S, compute the total distance i dist(c i, c j ) report the smalles such distance Q. What is the complexity of this algorithm? 19 / 41

23 Travelling Salesman: Naive Approach Counting Permutations of n vertices n possibilities for 1st city, n 2 for 2nd, n 3 for third... overall: n! different paths to check Estimate on a machine that does 1,000,000 steps per second simplified: this does not include overhead for moving on Turing tapes size time Q. What is the unit of time in the right-hand column? (we have seen this before) 20 / 41

24 Travelling Salesman as Decision Problem Travelling Salesman as Decision Problem. Given weighted graph G and k 0, is there a path that vists each vertex in G exactly once is of total cost k Guessing and Checking. Certificate for existence of path is path itself of polynomial size (if G is encoded reasonably, i.e at least one bit per vertex) Certificate Checking. As for Hamiltonian paths, plus check that the total cost of the path is k n 1 additions, one comparision polynomial so checking is polynomial, overall Corollary. Travellign Salesman as a decision problem is in NP. 21 / 41

25 The Knapsack Problem Given. A knapsack with maximal capacity C, and items with weights w 1,..., w n and values v 1,... v n What s the best way to fill the knapsack? sum of the weight of the items shouldn t exceed capacity sum of the values of the items should be maximal. Assumptions. all weights are strictly positive, i.e. w i 0 for all i = 1,..., n there is an unlimited supply of each item 22 / 41

26 Knapsack: Main Idea Construct a Table C m(0) m(1) m(2)... m(c) m(w) = value of the best knapsack with weight w m(0) = 0 (empty knapsack) m(w) = max{v i + m(w w i ) w i w} Solution. m(c) value of the best knapsack with capacity C Correctness Argument. the best knapsack with weight w must contain an item say item i removing this item, we get the best knapsack with weight w w i (otherwise, can have better knapsack with weight w) Solution. iteratively compute m(0), m(1),..., m(c) store already computed values in a table (don t recompute) 23 / 41

27 Knapsack: Complexity Analysis Complexity Analysis given capacity C and n items need to construct a table with C + 1 entries (starting at zero) for each > 0 entry for weight: need to check n items, compute maximum Overall complexity: n C Q. Does that mean that knapsack is linear or quadratic? 24 / 41

28 Knapsack: Encoding Recall. Complexity depends on encoding of input data usual encoding for numbers: as binary strings For Knapsack: Capacity: C as a binary integer (log C bits) number of items n as binary ingeger (log n bits) weights as n-element lists of binary integers values as n-element lists of binary integers Q. How large is C as a function of the length of the encoding of the knapsack problem in the worst case? 25 / 41

29 Knapsack: Encoding Recall. Complexity depends on encoding of input data usual encoding for numbers: as binary strings For Knapsack: Capacity: C as a binary integer (log C bits) number of items n as binary ingeger (log n bits) weights as n-element lists of binary integers values as n-element lists of binary integers Q. How large is C as a function of the length of the encoding of the knapsack problem in the worst case? A. In the worst case: one item, value 1, weight 1: 3 bits (plus separators) encoding of C has log C many bits, so C = 2 log C is exponential Overall Complexity. Exponential in the size of the problem if numbers are coded in binary only polynomial if C is coded in unary also called pseudo polytime 25 / 41

30 Summary of Problems Polytime Problems Given graph G, is G connected? Given weighted graph G, is there a path between vertices of cost k? Given propositional formula and truth-value assignment for the variables, does the formula evalute to true under this assignment? NP-Complete Problems Given Graph G, does it have a Hamiltonian path? Given Graph G, does it have a vertex cover of size k? Given graph G, does it have an independent set of size k? Given weighted graph G, does it have a Hamiltionian path of cost k? Given knapsack, can a value of k be achieved? On NP-Hardness. usually difficult to prove and omitted here strategy: by reduction (see e.g. vertex cover and independent set) 26 / 41

31 How About Route Planning? Route Planning as a graph problem. intersections of two roads are the nodes of the graph direct road connections are the vertices between intersections distance between intersections are the weights of the edges Google Maps (or similar) give starting point, end point, computes shortest path in seconds solves a travelling salesman problem over large graphs (millions of intersections) Q. Can we solve NP-complete problems in practice? 27 / 41

32 Route Planning in Practice Additional Information. can prune intersections by culling streets that are, say, 20km away from straight line start finish have additional information: often arterial roads connected with small roads either end not always the optimal route Problems In Practice. want/need to solve NP-complete problems (or worse) goal: best solution within given time constraints tradeoff computing time / optimality of the solution 28 / 41

33 Approximative Algorithms and Heuristics Heuristics. special problem solving strategies that work for only some instances problem instances of interest domain-dependent often: instances generated by humnans (e.g. road network) Approximative Algorithms. Goal: just a a good enough solution (e.g. for travelling salesman) strategy-based, e.g. greedy, evolutionary Example: Greedy Algorithms for travelling salesman start with a vertex, and go to nearest neighbour continue with nearest neighbour not already visited, etc. often gives good (within 25% of optimum) path Example: Iterative Strategies for travelling salesman start wiht a possibly non-optimal tour perturb the tour by removing a numner of edges replace the edges to get a shorter tour repeat until improvement is only marginal 29 / 41

34 Do not be afraid? NP-Complete Problems usually hard to solve in all cases often, just need solutions that are good enough or solutions for special cases Algorithmic Problems have appreciation of their complexity recognise hard problems choose best solutions, depending on context Engineering Context be aware of resources needed by software solution solutions for small sizes may not scale right tool for the job approach 30 / 41

35 Back to Computability Meta-Programming Use programs to to check properties of other programs here: use Turing machines to determine properties of other TMs Q. What type of properties of programs can we verify automatically? Decision Problem: given a TM, does the TM have this property? Negative Examples. Halting Problem Totality Problem: does TM M terminate on all inputs Q. Are there any positive examples? 31 / 41

36 Rice s Theorem Definition. A property P of languages of Turing machines is trivial, if either it holds for all languages or it holds for none. A property P is non-trivial, if it is not trivial. Examples of non-trivial properties of languages does a TM accept the string aab there is a TM that accepts aab, so it holds for some TMs there is a TM that doesn t accept aab, so it doesn t hold for all is the set of strings accepted by M finite? does M accept two different length strings?... Note. Properties of languages, i.e. the set of strings accepted by a TM. can reformulate in terms of L(M), sets of strings accepted by M 32 / 41

37 Rice s Theorem Theorem. Every non-trivial property of languages of Turing machines is undecidable. Detailed Meaning. Write L(M) for the language (accepted strings) of a TM. every language of a TM corresponds to a TM property of languages of TMs is of the form P = {C C a code of TM M and L(M) has property P} properties of languages are sets of TM codes the problem is C a code of a TM M s.t. L(M) has property P is undecidable if P is non-trivial. 33 / 41

38 Rice s Theorem: Non-Examples Caveat. Rice s Theorem is about properties of languages. It s not about properties of TMs. Properties of TMs Rice s Theorem doesn t apply does M ever write a 1 onto the tape? does M have exactly 17 states? Decidable Properties of TMs give algorithm M has 17 states (just check the encoding) on blank input, M terminates in 188 steps (just simulate M) Non-Decidable Properties of TMs give reduction there exists an input of length 20 on which M halts there is an input such that M writes a 1 onto the tape 34 / 41

39 Preliminaries: The Acceptance Problem Acceptance Problem. The problem {(M, w) M accepts w} is undecidable. Proof. By reduction to the halting problem. Let A be a TM that decides whether or not a TM M accepts a string w. Construction. Given input (M, w) to the halting problem. Result. change M to M which is like M, but all states are accepting thenm M accepts w if and only if M terminates on w run the TM A on the input (M, w) if A accepts (M, w) then M terminates on w if A does not accept (M, w) then M does not terminate on w Summary. If A would exist, we would be able to solve the halting problem, which is impossible. 35 / 41

40 Rice s Theorem: Proof Proof Strategy. By contradiction. Assume that a hypothetical TM M exists that decides whether a language has property P Create a contradiction by showing that then, we can also solve the acceptance problem (last slide) give input (M, w) to acceptance problem, construct TM M so that L(M ) has property P M accepts w as the acceptance problem is undecidable, M cannot exist. (We have seen this proof strategy before) 36 / 41

41 Proof Detail. Assumptions. let P be a non-trivial property of languages of TMs. assume first that / P and let M P be a TM such that L(M P ) P. Construction. Given input (M, w) for acceptance problem construct TM M w that behaves as follows on input x first run M on w if M accepts w, run M P on string x Result. M w accepts x iff M accepts w and M P accepts x so L(M w ) = if M does not accept w and L(M w ) = L(M P ) if M does accept w hence L(M w ) satisfies P iff M accepts w because L(MP ) P and / P Summary. If P were decidable, we could decide the acceptance problem. 37 / 41

42 Proof of Rice s Theorem, Continued Recall. have assumed that / P i.e. the empty language does not have property P Missing Case. P then the complement of P of P is a non-trivial property the complement P satisfies / P by first case, P is not decidable. Construction. Assume that P were decidable by TM M P swap accepting and non-accepting states to obtain M P accepts precisely the complement of P M P Summary. M P cannot exist, as the complement of P is not decidable. 38 / 41

43 Summary Bad News. there are lots of problems that are undecidable about TMs Rice s theorem gives plenty any property of languages But... specific instances may be decidable often useful to search for solutions Example. Provability in First-Order Logic not decidable, but there are plenty of implementations implementations may not terminate... goal: try and solve as many problems as possible problem of interest: usually human-generated 39 / 41

44 Course Summary Alignment you can already do programming (functional / imperative) Questions. What do programs really do? What is computation in general? What are the limits? Answers. use logic to formally describe systems functional programs: induction proofs imperative programs: Hoare logics computation in general: Turing machines 40 / 41

45 Exam: Nov 3, 2017 Good Luck! use the drop-in session use the study event use your tutorials 41 / 41

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 3 Definitions an undirected graph G = (V, E)

More information

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions Introduction Chapter 9 Graph Algorithms graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 2 Definitions an undirected graph G = (V, E) is

More information

Theorem 2.9: nearest addition algorithm

Theorem 2.9: nearest addition algorithm There are severe limits on our ability to compute near-optimal tours It is NP-complete to decide whether a given undirected =(,)has a Hamiltonian cycle An approximation algorithm for the TSP can be used

More information

Unit 8: Coping with NP-Completeness. Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems. Y.-W.

Unit 8: Coping with NP-Completeness. Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems. Y.-W. : Coping with NP-Completeness Course contents: Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems Reading: Chapter 34 Chapter 35.1, 35.2 Y.-W. Chang 1 Complexity

More information

Best known solution time is Ω(V!) Check every permutation of vertices to see if there is a graph edge between adjacent vertices

Best known solution time is Ω(V!) Check every permutation of vertices to see if there is a graph edge between adjacent vertices Hard Problems Euler-Tour Problem Undirected graph G=(V,E) An Euler Tour is a path where every edge appears exactly once. The Euler-Tour Problem: does graph G have an Euler Path? Answerable in O(E) time.

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Introduction graph theory useful in practice represent many real-life problems can be if not careful with data structures Chapter 9 Graph s 2 Definitions Definitions an undirected graph is a finite set

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be if not careful with data structures 3 Definitions an undirected graph G = (V, E) is a

More information

Module 6 NP-Complete Problems and Heuristics

Module 6 NP-Complete Problems and Heuristics Module 6 NP-Complete Problems and Heuristics Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu P, NP-Problems Class

More information

Module 6 P, NP, NP-Complete Problems and Approximation Algorithms

Module 6 P, NP, NP-Complete Problems and Approximation Algorithms Module 6 P, NP, NP-Complete Problems and Approximation Algorithms Dr. Natarajan Meghanathan Associate Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu

More information

The Satisfiability Problem [HMU06,Chp.10b] Satisfiability (SAT) Problem Cook s Theorem: An NP-Complete Problem Restricted SAT: CSAT, k-sat, 3SAT

The Satisfiability Problem [HMU06,Chp.10b] Satisfiability (SAT) Problem Cook s Theorem: An NP-Complete Problem Restricted SAT: CSAT, k-sat, 3SAT The Satisfiability Problem [HMU06,Chp.10b] Satisfiability (SAT) Problem Cook s Theorem: An NP-Complete Problem Restricted SAT: CSAT, k-sat, 3SAT 1 Satisfiability (SAT) Problem 2 Boolean Expressions Boolean,

More information

Final Exam May 8, 2018

Final Exam May 8, 2018 Real name: CS/ECE 374 A Spring 2018 Final Exam May 8, 2018 NetID: Gradescope name: Gradescope email: Don t panic! If you brought anything except your writing implements and your two double-sided 8½" 11"

More information

Chapter 8. NP-complete problems

Chapter 8. NP-complete problems Chapter 8. NP-complete problems Search problems E cient algorithms We have developed algorithms for I I I I I finding shortest paths in graphs, minimum spanning trees in graphs, matchings in bipartite

More information

P and NP CISC5835, Algorithms for Big Data CIS, Fordham Univ. Instructor: X. Zhang

P and NP CISC5835, Algorithms for Big Data CIS, Fordham Univ. Instructor: X. Zhang P and NP CISC5835, Algorithms for Big Data CIS, Fordham Univ. Instructor: X. Zhang Efficient Algorithms So far, we have developed algorithms for finding shortest paths in graphs, minimum spanning trees

More information

Chapter 3: Paths and Cycles

Chapter 3: Paths and Cycles Chapter 3: Paths and Cycles 5 Connectivity 1. Definitions: Walk: finite sequence of edges in which any two consecutive edges are adjacent or identical. (Initial vertex, Final vertex, length) Trail: walk

More information

P and NP CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang

P and NP CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang P and NP CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang Efficient Algorithms So far, we have developed algorithms for finding shortest paths in graphs, minimum spanning trees in

More information

NP-Hardness. We start by defining types of problem, and then move on to defining the polynomial-time reductions.

NP-Hardness. We start by defining types of problem, and then move on to defining the polynomial-time reductions. CS 787: Advanced Algorithms NP-Hardness Instructor: Dieter van Melkebeek We review the concept of polynomial-time reductions, define various classes of problems including NP-complete, and show that 3-SAT

More information

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and Computer Language Theory Chapter 4: Decidability 1 Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

More information

Steven Skiena. skiena

Steven Skiena.   skiena Lecture 22: Introduction to NP-completeness (1997) Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Among n people,

More information

Optimal tour along pubs in the UK

Optimal tour along pubs in the UK 1 From Facebook Optimal tour along 24727 pubs in the UK Road distance (by google maps) see also http://www.math.uwaterloo.ca/tsp/pubs/index.html (part of TSP homepage http://www.math.uwaterloo.ca/tsp/

More information

Module 6 NP-Complete Problems and Heuristics

Module 6 NP-Complete Problems and Heuristics Module 6 NP-Complete Problems and Heuristics Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 397 E-mail: natarajan.meghanathan@jsums.edu Optimization vs. Decision

More information

P and NP (Millenium problem)

P and NP (Millenium problem) CMPS 2200 Fall 2017 P and NP (Millenium problem) Carola Wenk Slides courtesy of Piotr Indyk with additions by Carola Wenk CMPS 2200 Introduction to Algorithms 1 We have seen so far Algorithms for various

More information

Module 6 NP-Complete Problems and Heuristics

Module 6 NP-Complete Problems and Heuristics Module 6 NP-Complete Problems and Heuristics Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 97 E-mail: natarajan.meghanathan@jsums.edu Optimization vs. Decision

More information

Introduction to Algorithms

Introduction to Algorithms Introduction to Algorithms 6.046J/18.401 Lecture 21 Prof. Piotr Indyk P vs NP (interconnectedness of all things) A whole course by itself We ll do just two lectures More in 6.045, 6.840J, etc. Introduction

More information

Some Hardness Proofs

Some Hardness Proofs Some Hardness Proofs Magnus Lie Hetland January 2011 This is a very brief overview of some well-known hard (NP Hard and NP complete) problems, and the main ideas behind their hardness proofs. The document

More information

FINAL EXAM SOLUTIONS

FINAL EXAM SOLUTIONS COMP/MATH 3804 Design and Analysis of Algorithms I Fall 2015 FINAL EXAM SOLUTIONS Question 1 (12%). Modify Euclid s algorithm as follows. function Newclid(a,b) if a

More information

implementing the breadth-first search algorithm implementing the depth-first search algorithm

implementing the breadth-first search algorithm implementing the depth-first search algorithm Graph Traversals 1 Graph Traversals representing graphs adjacency matrices and adjacency lists 2 Implementing the Breadth-First and Depth-First Search Algorithms implementing the breadth-first search algorithm

More information

NP-Completeness. Algorithms

NP-Completeness. Algorithms NP-Completeness Algorithms The NP-Completeness Theory Objective: Identify a class of problems that are hard to solve. Exponential time is hard. Polynomial time is easy. Why: Do not try to find efficient

More information

NP-Complete Problems

NP-Complete Problems 1 / 34 NP-Complete Problems CS 584: Algorithm Design and Analysis Daniel Leblanc 1 1 Senior Adjunct Instructor Portland State University Maseeh College of Engineering and Computer Science Winter 2018 2

More information

Reference Sheet for CO142.2 Discrete Mathematics II

Reference Sheet for CO142.2 Discrete Mathematics II Reference Sheet for CO14. Discrete Mathematics II Spring 017 1 Graphs Defintions 1. Graph: set of N nodes and A arcs such that each a A is associated with an unordered pair of nodes.. Simple graph: no

More information

Introduction to Algorithms. Lecture 24. Prof. Patrick Jaillet

Introduction to Algorithms. Lecture 24. Prof. Patrick Jaillet 6.006- Introduction to Algorithms Lecture 24 Prof. Patrick Jaillet Outline Decision vs optimization problems P, NP, co-np Reductions between problems NP-complete problems Beyond NP-completeness Readings

More information

CS 125 Section #10 Midterm 2 Review 11/5/14

CS 125 Section #10 Midterm 2 Review 11/5/14 CS 125 Section #10 Midterm 2 Review 11/5/14 1 Topics Covered This midterm covers up through NP-completeness; countability, decidability, and recognizability will not appear on this midterm. Disclaimer:

More information

The Turing Machine. Unsolvable Problems. Undecidability. The Church-Turing Thesis (1936) Decision Problem. Decision Problems

The Turing Machine. Unsolvable Problems. Undecidability. The Church-Turing Thesis (1936) Decision Problem. Decision Problems The Turing Machine Unsolvable Problems Motivating idea Build a theoretical a human computer Likened to a human with a paper and pencil that can solve problems in an algorithmic way The theoretical machine

More information

CSE 100: B+ TREE, 2-3 TREE, NP- COMPLETNESS

CSE 100: B+ TREE, 2-3 TREE, NP- COMPLETNESS CSE 100: B+ TREE, 2-3 TREE, NP- COMPLETNESS Analyzing find in B-trees Since the B-tree is perfectly height-balanced, the worst case time cost for find is O(logN) Best case: If every internal node is completely

More information

More NP-complete Problems. CS255 Chris Pollett May 3, 2006.

More NP-complete Problems. CS255 Chris Pollett May 3, 2006. More NP-complete Problems CS255 Chris Pollett May 3, 2006. Outline More NP-Complete Problems Hamiltonian Cycle Recall a hamiltonian cycle is a permutation of the vertices v i_1,, v i_n of a graph G so

More information

Dijkstra's Algorithm

Dijkstra's Algorithm Carlos Moreno cmoreno @ uwaterloo.ca EIT-4103 Image courtesy of wikipedia.org https://ece.uwaterloo.ca/~cmoreno/ece250 Standard reminder to set phones to silent/vibrate mode, please! During today's class

More information

Practice Final Exam 1

Practice Final Exam 1 Algorithm esign Techniques Practice Final xam Instructions. The exam is hours long and contains 6 questions. Write your answers clearly. You may quote any result/theorem seen in the lectures or in the

More information

Principles of AI Planning. Principles of AI Planning. 7.1 How to obtain a heuristic. 7.2 Relaxed planning tasks. 7.1 How to obtain a heuristic

Principles of AI Planning. Principles of AI Planning. 7.1 How to obtain a heuristic. 7.2 Relaxed planning tasks. 7.1 How to obtain a heuristic Principles of AI Planning June 8th, 2010 7. Planning as search: relaxed planning tasks Principles of AI Planning 7. Planning as search: relaxed planning tasks Malte Helmert and Bernhard Nebel 7.1 How to

More information

END-TERM EXAMINATION

END-TERM EXAMINATION (Please Write your Exam Roll No. immediately) Exam. Roll No... END-TERM EXAMINATION Paper Code : MCA-205 DECEMBER 2006 Subject: Design and analysis of algorithm Time: 3 Hours Maximum Marks: 60 Note: Attempt

More information

NP-complete Reductions

NP-complete Reductions NP-complete Reductions 1. Prove that 3SAT P DOUBLE-SAT, i.e., show DOUBLE-SAT is NP-complete by reduction from 3SAT. The 3-SAT problem consists of a conjunction of clauses over n Boolean variables, where

More information

Notes for Lecture 24

Notes for Lecture 24 U.C. Berkeley CS170: Intro to CS Theory Handout N24 Professor Luca Trevisan December 4, 2001 Notes for Lecture 24 1 Some NP-complete Numerical Problems 1.1 Subset Sum The Subset Sum problem is defined

More information

Introduction to Graph Theory

Introduction to Graph Theory Introduction to Graph Theory Tandy Warnow January 20, 2017 Graphs Tandy Warnow Graphs A graph G = (V, E) is an object that contains a vertex set V and an edge set E. We also write V (G) to denote the vertex

More information

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29

Lecture 13. Reading: Weiss, Ch. 9, Ch 8 CSE 100, UCSD: LEC 13. Page 1 of 29 Lecture 13 Connectedness in graphs Spanning trees in graphs Finding a minimal spanning tree Time costs of graph problems and NP-completeness Finding a minimal spanning tree: Prim s and Kruskal s algorithms

More information

Graph Theory. Chapter 4.

Graph Theory. Chapter 4. Graph Theory. Chapter 4. Wandering. Here is an algorithm, due to Tarry, that constructs a walk in a connected graph, starting at any vertex v 0, traversing each edge exactly once in each direction, and

More information

Exercises Computational Complexity

Exercises Computational Complexity Exercises Computational Complexity March 22, 2017 Exercises marked with a are more difficult. 1 Chapter 7, P and NP Exercise 1. Suppose some pancakes are stacked on a surface such that no two pancakes

More information

Recursively Enumerable Languages, Turing Machines, and Decidability

Recursively Enumerable Languages, Turing Machines, and Decidability Recursively Enumerable Languages, Turing Machines, and Decidability 1 Problem Reduction: Basic Concepts and Analogies The concept of problem reduction is simple at a high level. You simply take an algorithm

More information

Greedy Algorithms 1. For large values of d, brute force search is not feasible because there are 2 d

Greedy Algorithms 1. For large values of d, brute force search is not feasible because there are 2 d Greedy Algorithms 1 Simple Knapsack Problem Greedy Algorithms form an important class of algorithmic techniques. We illustrate the idea by applying it to a simplified version of the Knapsack Problem. Informally,

More information

Questions? You are given the complete graph of Facebook. What questions would you ask? (What questions could we hope to answer?)

Questions? You are given the complete graph of Facebook. What questions would you ask? (What questions could we hope to answer?) P vs. NP What now? Attribution These slides were prepared for the New Jersey Governor s School course The Math Behind the Machine taught in the summer of 2011 by Grant Schoenebeck Large parts of these

More information

Ma/CS 6a Class 27: Shortest Paths

Ma/CS 6a Class 27: Shortest Paths // Ma/CS a Class 7: Shortest Paths By Adam Sheffer Naïve Path Planning Problem. We are given a map with cities and noncrossing roads between pairs of cities. Describe an algorithm for finding a path between

More information

PSD1A. DESIGN AND ANALYSIS OF ALGORITHMS Unit : I-V

PSD1A. DESIGN AND ANALYSIS OF ALGORITHMS Unit : I-V PSD1A DESIGN AND ANALYSIS OF ALGORITHMS Unit : I-V UNIT I -- Introduction -- Definition of Algorithm -- Pseudocode conventions -- Recursive algorithms -- Time and space complexity -- Big- o notation --

More information

Computational problems. Lecture 2: Combinatorial search and optimisation problems. Computational problems. Examples. Example

Computational problems. Lecture 2: Combinatorial search and optimisation problems. Computational problems. Examples. Example Lecture 2: Combinatorial search and optimisation problems Different types of computational problems Examples of computational problems Relationships between problems Computational properties of different

More information

Practice Problems for the Final

Practice Problems for the Final ECE-250 Algorithms and Data Structures (Winter 2012) Practice Problems for the Final Disclaimer: Please do keep in mind that this problem set does not reflect the exact topics or the fractions of each

More information

8 NP-complete problem Hard problems: demo

8 NP-complete problem Hard problems: demo Ch8 NPC Millennium Prize Problems http://en.wikipedia.org/wiki/millennium_prize_problems 8 NP-complete problem Hard problems: demo NP-hard (Non-deterministic Polynomial-time hard), in computational complexity

More information

looking ahead to see the optimum

looking ahead to see the optimum ! Make choice based on immediate rewards rather than looking ahead to see the optimum! In many cases this is effective as the look ahead variation can require exponential time as the number of possible

More information

3 No-Wait Job Shops with Variable Processing Times

3 No-Wait Job Shops with Variable Processing Times 3 No-Wait Job Shops with Variable Processing Times In this chapter we assume that, on top of the classical no-wait job shop setting, we are given a set of processing times for each operation. We may select

More information

Greedy Algorithms 1 {K(S) K(S) C} For large values of d, brute force search is not feasible because there are 2 d {1,..., d}.

Greedy Algorithms 1 {K(S) K(S) C} For large values of d, brute force search is not feasible because there are 2 d {1,..., d}. Greedy Algorithms 1 Simple Knapsack Problem Greedy Algorithms form an important class of algorithmic techniques. We illustrate the idea by applying it to a simplified version of the Knapsack Problem. Informally,

More information

3 Euler Tours, Hamilton Cycles, and Their Applications

3 Euler Tours, Hamilton Cycles, and Their Applications 3 Euler Tours, Hamilton Cycles, and Their Applications 3.1 Euler Tours and Applications 3.1.1 Euler tours Carefully review the definition of (closed) walks, trails, and paths from Section 1... Definition

More information

8 Matroid Intersection

8 Matroid Intersection 8 Matroid Intersection 8.1 Definition and examples 8.2 Matroid Intersection Algorithm 8.1 Definitions Given two matroids M 1 = (X, I 1 ) and M 2 = (X, I 2 ) on the same set X, their intersection is M 1

More information

We ve studied the main models and concepts of the theory of computation:

We ve studied the main models and concepts of the theory of computation: CMPSCI 601: Summary & Conclusions Lecture 27 We ve studied the main models and concepts of the theory of computation: Computability: what can be computed in principle Logic: how can we express our requirements

More information

COMP Analysis of Algorithms & Data Structures

COMP Analysis of Algorithms & Data Structures COMP 3170 - Analysis of Algorithms & Data Structures Shahin Kamali Approximation Algorithms CLRS 35.1-35.5 University of Manitoba COMP 3170 - Analysis of Algorithms & Data Structures 1 / 30 Approaching

More information

Assignment 5: Solutions

Assignment 5: Solutions Algorithm Design Techniques Assignment 5: Solutions () Port Authority. [This problem is more commonly called the Bin Packing Problem.] (a) Suppose K = 3 and (w, w, w 3, w 4 ) = (,,, ). The optimal solution

More information

Discrete mathematics II. - Graphs

Discrete mathematics II. - Graphs Emil Vatai April 25, 2018 Basic definitions Definition of an undirected graph Definition (Undirected graph) An undirected graph or (just) a graph is a triplet G = (ϕ, E, V ), where V is the set of vertices,

More information

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Shortest Paths Date: 10/13/15

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Shortest Paths Date: 10/13/15 600.363 Introduction to Algorithms / 600.463 Algorithms I Lecturer: Michael Dinitz Topic: Shortest Paths Date: 10/13/15 14.1 Introduction Today we re going to talk about algorithms for computing shortest

More information

CS521 \ Notes for the Final Exam

CS521 \ Notes for the Final Exam CS521 \ Notes for final exam 1 Ariel Stolerman Asymptotic Notations: CS521 \ Notes for the Final Exam Notation Definition Limit Big-O ( ) Small-o ( ) Big- ( ) Small- ( ) Big- ( ) Notes: ( ) ( ) ( ) ( )

More information

Recitation 4: Elimination algorithm, reconstituted graph, triangulation

Recitation 4: Elimination algorithm, reconstituted graph, triangulation Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.438 Algorithms For Inference Fall 2014 Recitation 4: Elimination algorithm, reconstituted graph, triangulation

More information

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207 Name: 1 a 20 b 20 c 20 d 20 e 20 f 20 g 20 2 10 3 30 4 12 5 15 Total 207 CS 341 Practice Final Exam 1. Please write neatly. You will lose points if we cannot figure out what you are saying. 2. Whenever

More information

Vertex Cover Approximations

Vertex Cover Approximations CS124 Lecture 20 Heuristics can be useful in practice, but sometimes we would like to have guarantees. Approximation algorithms give guarantees. It is worth keeping in mind that sometimes approximation

More information

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD Recap. Growth rates: Arrange the following functions in ascending order of growth rate: n 2 log n n log n 2 log n n/ log n n n Introduction Algorithm: A step-by-step way of solving a problem. Design of

More information

IE 102 Spring Routing Through Networks - 1

IE 102 Spring Routing Through Networks - 1 IE 102 Spring 2017 Routing Through Networks - 1 The Bridges of Koenigsberg: Euler 1735 Graph Theory began in 1735 Leonard Eüler Visited Koenigsberg People wondered whether it is possible to take a walk,

More information

NP-Complete Problems

NP-Complete Problems NP-omplete Problems P and NP Polynomial time reductions Satisfiability Problem, lique Problem, Vertex over, and ominating Set 10/19/2009 SE 5311 FLL 2009 KUMR 1 Polynomial lgorithms Problems encountered

More information

Today. Types of graphs. Complete Graphs. Trees. Hypercubes.

Today. Types of graphs. Complete Graphs. Trees. Hypercubes. Today. Types of graphs. Complete Graphs. Trees. Hypercubes. Complete Graph. K n complete graph on n vertices. All edges are present. Everyone is my neighbor. Each vertex is adjacent to every other vertex.

More information

Stanford University CS261: Optimization Handout 1 Luca Trevisan January 4, 2011

Stanford University CS261: Optimization Handout 1 Luca Trevisan January 4, 2011 Stanford University CS261: Optimization Handout 1 Luca Trevisan January 4, 2011 Lecture 1 In which we describe what this course is about and give two simple examples of approximation algorithms 1 Overview

More information

PATH FINDING AND GRAPH TRAVERSAL

PATH FINDING AND GRAPH TRAVERSAL GRAPH TRAVERSAL PATH FINDING AND GRAPH TRAVERSAL Path finding refers to determining the shortest path between two vertices in a graph. We discussed the Floyd Warshall algorithm previously, but you may

More information

CS261: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem

CS261: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem CS61: A Second Course in Algorithms Lecture #16: The Traveling Salesman Problem Tim Roughgarden February 5, 016 1 The Traveling Salesman Problem (TSP) In this lecture we study a famous computational problem,

More information

(p 300) Theorem 7.27 SAT is in P iff P=NP

(p 300) Theorem 7.27 SAT is in P iff P=NP pp. 292-311. The Class NP-Complete (Sec. 7.4) P = {L L decidable in poly time} NP = {L L verifiable in poly time} Certainly all P is in NP Unknown if NP is bigger than P (p. 299) NP-Complete = subset of

More information

CS 125 Section #6 Graph Traversal and Linear Programs 10/13/14

CS 125 Section #6 Graph Traversal and Linear Programs 10/13/14 CS 125 Section #6 Graph Traversal and Linear Programs 10/13/14 1 Depth first search 1.1 The Algorithm Besides breadth first search, which we saw in class in relation to Dijkstra s algorithm, there is one

More information

Coping with the Limitations of Algorithm Power Exact Solution Strategies Backtracking Backtracking : A Scenario

Coping with the Limitations of Algorithm Power Exact Solution Strategies Backtracking Backtracking : A Scenario Coping with the Limitations of Algorithm Power Tackling Difficult Combinatorial Problems There are two principal approaches to tackling difficult combinatorial problems (NP-hard problems): Use a strategy

More information

Topic 10 Part 2 [474 marks]

Topic 10 Part 2 [474 marks] Topic Part 2 [474 marks] The complete graph H has the following cost adjacency matrix Consider the travelling salesman problem for H a By first finding a minimum spanning tree on the subgraph of H formed

More information

Final. Name: TA: Section Time: Course Login: Person on Left: Person on Right: U.C. Berkeley CS170 : Algorithms, Fall 2013

Final. Name: TA: Section Time: Course Login: Person on Left: Person on Right: U.C. Berkeley CS170 : Algorithms, Fall 2013 U.C. Berkeley CS170 : Algorithms, Fall 2013 Final Professor: Satish Rao December 16, 2013 Name: Final TA: Section Time: Course Login: Person on Left: Person on Right: Answer all questions. Read them carefully

More information

2. Optimization problems 6

2. Optimization problems 6 6 2.1 Examples... 7... 8 2.3 Convex sets and functions... 9 2.4 Convex optimization problems... 10 2.1 Examples 7-1 An (NP-) optimization problem P 0 is defined as follows Each instance I P 0 has a feasibility

More information

CMPSCI611: Approximating SET-COVER Lecture 21

CMPSCI611: Approximating SET-COVER Lecture 21 CMPSCI611: Approximating SET-COVER Lecture 21 Today we look at two more examples of approximation algorithms for NP-hard optimization problems. The first, for the SET-COVER problem, has an approximation

More information

4 Dynamic Programming

4 Dynamic Programming 4 Dynamic Programming Dynamic Programming is a form of recursion. In Computer Science, you have probably heard the tradeoff between Time and Space. There is a trade off between the space complexity and

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

Traveling Salesman Problem (TSP) Input: undirected graph G=(V,E), c: E R + Goal: find a tour (Hamiltonian cycle) of minimum cost

Traveling Salesman Problem (TSP) Input: undirected graph G=(V,E), c: E R + Goal: find a tour (Hamiltonian cycle) of minimum cost Traveling Salesman Problem (TSP) Input: undirected graph G=(V,E), c: E R + Goal: find a tour (Hamiltonian cycle) of minimum cost Traveling Salesman Problem (TSP) Input: undirected graph G=(V,E), c: E R

More information

CSE 417 Network Flows (pt 4) Min Cost Flows

CSE 417 Network Flows (pt 4) Min Cost Flows CSE 417 Network Flows (pt 4) Min Cost Flows Reminders > HW6 is due Monday Review of last three lectures > Defined the maximum flow problem find the feasible flow of maximum value flow is feasible if it

More information

Travelling Salesman Problem. Algorithms and Networks 2015/2016 Hans L. Bodlaender Johan M. M. van Rooij

Travelling Salesman Problem. Algorithms and Networks 2015/2016 Hans L. Bodlaender Johan M. M. van Rooij Travelling Salesman Problem Algorithms and Networks 2015/2016 Hans L. Bodlaender Johan M. M. van Rooij 1 Contents TSP and its applications Heuristics and approximation algorithms Construction heuristics,

More information

Traveling Salesman Problem. Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij

Traveling Salesman Problem. Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij Traveling Salesman Problem Algorithms and Networks 2014/2015 Hans L. Bodlaender Johan M. M. van Rooij 1 Contents TSP and its applications Heuristics and approximation algorithms Construction heuristics,

More information

NP and computational intractability. Kleinberg and Tardos, chapter 8

NP and computational intractability. Kleinberg and Tardos, chapter 8 NP and computational intractability Kleinberg and Tardos, chapter 8 1 Major Transition So far we have studied certain algorithmic patterns Greedy, Divide and conquer, Dynamic programming to develop efficient

More information

Contents. 1 Introduction. 2 Searching and Traversal Techniques. Preface... (vii) Acknowledgements... (ix)

Contents. 1 Introduction. 2 Searching and Traversal Techniques. Preface... (vii) Acknowledgements... (ix) Contents Preface... (vii) Acknowledgements... (ix) 1 Introduction 1.1 Algorithm 1 1.2 Life Cycle of Design and Analysis of Algorithm 2 1.3 Pseudo-Code for Expressing Algorithms 5 1.4 Recursive Algorithms

More information

Greedy algorithms Or Do the right thing

Greedy algorithms Or Do the right thing Greedy algorithms Or Do the right thing March 1, 2005 1 Greedy Algorithm Basic idea: When solving a problem do locally the right thing. Problem: Usually does not work. VertexCover (Optimization Version)

More information

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C.

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C. 219 Lemma J For all languages A, B, C the following hold i. A m A, (reflexive) ii. if A m B and B m C, then A m C, (transitive) iii. if A m B and B is Turing-recognizable, then so is A, and iv. if A m

More information

Combinatorial Optimization

Combinatorial Optimization Combinatorial Optimization Frank de Zeeuw EPFL 2012 Today Introduction Graph problems - What combinatorial things will we be optimizing? Algorithms - What kind of solution are we looking for? Linear Programming

More information

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016 University of Nevada, Las Vegas Computer Science 456/656 Fall 2016 The entire examination is 925 points. The real final will be much shorter. Name: No books, notes, scratch paper, or calculators. Use pen

More information

1 Definition of Reduction

1 Definition of Reduction 1 Definition of Reduction Problem A is reducible, or more technically Turing reducible, to problem B, denoted A B if there a main program M to solve problem A that lacks only a procedure to solve problem

More information

1 The Traveling Salesperson Problem (TSP)

1 The Traveling Salesperson Problem (TSP) CS 598CSC: Approximation Algorithms Lecture date: January 23, 2009 Instructor: Chandra Chekuri Scribe: Sungjin Im In the previous lecture, we had a quick overview of several basic aspects of approximation

More information

Online Graph Exploration

Online Graph Exploration Distributed Computing Online Graph Exploration Semester thesis Simon Hungerbühler simonhu@ethz.ch Distributed Computing Group Computer Engineering and Networks Laboratory ETH Zürich Supervisors: Sebastian

More information

CSCE 350: Chin-Tser Huang. University of South Carolina

CSCE 350: Chin-Tser Huang. University of South Carolina CSCE 350: Data Structures and Algorithms Chin-Tser Huang huangct@cse.sc.edu University of South Carolina Announcement Homework 2 will be returned on Thursday; solution will be available on class website

More information

CS70 - Lecture 6. Graphs: Coloring; Special Graphs. 1. Review of L5 2. Planar Five Color Theorem 3. Special Graphs:

CS70 - Lecture 6. Graphs: Coloring; Special Graphs. 1. Review of L5 2. Planar Five Color Theorem 3. Special Graphs: CS70 - Lecture 6 Graphs: Coloring; Special Graphs 1. Review of L5 2. Planar Five Color Theorem 3. Special Graphs: Trees: Three characterizations Hypercubes: Strongly connected! Administration You need

More information

CS 4407 Algorithms. Lecture 8: Circumventing Intractability, using Approximation and other Techniques

CS 4407 Algorithms. Lecture 8: Circumventing Intractability, using Approximation and other Techniques CS 4407 Algorithms Lecture 8: Circumventing Intractability, using Approximation and other Techniques Prof. Gregory Provan Department of Computer Science University College Cork CS 4010 1 Lecture Outline

More information

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance. Algorithm Design Patterns and Anti-Patterns 8. NP and Computational Intractability Algorithm design patterns. Ex.! Greed. O(n log n) interval scheduling.! Divide-and-conquer. O(n log n) FFT.! Dynamic programming.

More information

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine CS 275 Automata and Formal Language Theory Course Notes Part III: Limits of Computation Chapt. III.3: Turing Machines Anton Setzer http://www.cs.swan.ac.uk/ csetzer/lectures/ automataformallanguage/13/index.html

More information