COMP202. Complexity of Algorithms. Section 1: Answer all questions. Section 2: Answer 2 questions.
|
|
- Tamsin Wilkins
- 5 years ago
- Views:
Transcription
1 COMP202 Complexity of Algorithms Section 1: Answer all questions. Section 2: Answer 2 questions.
2 2 Section 1 Answer all questions in this section. 1. Define what is meant by the following terms, An n-vertex undirected graph. (3 marks) A strongly connected directed graph. (3 marks) The Time Complexity of a decision problem. (3 marks) (d) The complexity class Polynomial Time. (3 marks) (e) NP-complete decision problem. (3 marks) 2. For the 4-vectors, a = [ a 0, a 1, a 2, a 3 ] = [1,5,3,6] b=[b 0,b 1,b 2,b 3 ]=[2,4,0,7] Give the formal polynomials P a ( x )and P b ( x )represented by a and b. (5marks) Find the convolution - a b - of a and b. (10 marks) c = [ c 0, c 1, c 2, c 3, c 4, c 5, c 6, c 7 ]
3 3 3. In the 10-vertex directed graph, State whether or not each of the following sets of vertices are in the same strongly-connected component and give a brief justification for your answer in each case. Vertices 1 and 7. (5marks). Vertices 3 and 4. (4marks). Vertices 8, 9, and 10 (6 marks). 4. Carefully define each of the following NP-complete decision problems, giving the form that an instance of each problem takes and the question being asked of these instances. The Satisfiability Problem (SAT ). (5 marks) The 3Colouring Problem (3 COL). (5 marks) The Hamiltonian Cycle Problem (HC). (5 marks).
4 4 Section 2 Answer two of Questions 5, 6, and Briefly outline how the Discrete Fourier Transform (DFT )can be used to compute the convolution of 2 n-vectors, a = [ a 0, a 1,...,a n 1 ] b=[b 0,b 1,...,b n 1 ] [Do not describe the details of the Fourier Transform process itself.]. (5 marks) Carefully describe how the recursive Discrete Fourier Transform method computes DFT ( x, n, ω )with x = [4,5,8,6] ; n = 4 ; ω = 4 and arithmetic calcluations being performed modulo M = 17. (10 marks). The run-time of the Schönhage-Strassen multiplication algorithm is measured in terms of the number of bit operations - O B () it performs.. What is the principal difficulty that would arise in attempting to adapt this method to work directly with decimal (rather than binary) representations? (5 marks)
5 5 6. State necessary and sufficient conditions for a connected, undirected graph G( V, E )tohave an Eulerian Tour. (5marks) In the undirected graph below, carefully show how the partial tour <{7,6},{6,2},{2,1},{1,7},{7,8},{8,10},{10, 7 } > that contains all of the edges adjacent to vertex 7,isextended to a complete Eulerian Tour of the graph. (10 marks) The edge-dual of a graph G( V, E )isthe graph Ĝ( W, F )formed by replacing each edge { x, y }ineby a single vertex u {x,y} in W. The edges of Ĝ connect those vertices whose corresponding edges in E have a common end-point, e.g. as in the example below ,2 1,3 3,4 3 2,3 3,5 4,5 4 5 G Ĝ G has an Eulerian Tour if and only if Ĝ has a Hamiltonian cycle. Now consider the following algorithm: given G, construct the graph H for which Ĥ = G and test if H has an Eulerian Tour. Briefly explain why this algorithm not yield a method for deciding if an arbitrary graph has a Hamiltonian cycle. (5 marks)
6 6 7. Given the following instance, F, ofcnf SAT, F( X 8 ) = ( x 1 ) ( x 2 x 8 ) ( x 3 x 4 x 5 x 7 ) ( x 1 x 2 x 4 x 5 x 6 x 7 ) (x 4 x 5 x 7 ) ( x 4 x 7 x 8 ) Identify all of the clauses of F which are not in the form required by the decision problem 3-SAT.(5marks) Carefully show how this instance can be transformed into an instance, G F,of3-SAT that is satisfiable if and only if F is satisfiable. (10 marks) An instance of the decision problem PART 3 SAT consists of an instance F( X n ) = m C j = m ( y j,1 y j,2 y j,3 ) j=1 j=1 of 3 SAT and two positive integers r and s (with r/s <1). The question asked of these being: "is there an assignment to X n that satisfies at least (mr/s) ofthe clauses C j?". Prove that PART 3 SAT is NP-complete, by showing that the restricted case with r = 8and s = 9isNP-complete. [Hint: Use a reduction that transforms instances F( X n ) = m C j of 3 SAT to instances ( G F,8,9) of PART 3 SAT in which G F ( X n, Z t ) = F( X n ) H( Z t ) with H( Z t )having exactly 8m clauses and Z t is a set of 3m new variables.] (5 marks) j=1 END OF PAPER
7 7 Model Solutions 1. An n-vertex undirected graph, G( V, E ) is defined by a set V = { v 1,...,v n }ofnvertices, and a set E of unordered pairs of distinct vertices called the graph edges. A directed graph H(W, F) isstrongly connected if for each pair of distinct vertices x and y in W there is a directed path from x to y and a directed path from y to x. The time complexity of a decision problem, f, is a function T : N N, such that there is a deterministic Turing machine, M, that correctly decides all instances of length n in at most T (n) moves. Also accept run-time of fastest algorithm for f orsimilar. (d) A decision problem f is in the complexity class Polynomial Time (P), if there is a deterministic Turing machine program, M deciding f and aconstant k such that for any input x of length n, M makes at most n k moves onx. (e) f is NP-complete if f NP and g NP, g p f. 2. P a ( x ) = 1 + 5x + 3x 2 + 6x 3 P b ( x ) = 2 + 4x + 0x 2 + 7x 3 or P b (x) = 2 + 4x + 7x 3 The component c k (0 k 7) of a b is: c k = Σ k a j * b k j with a i = b i = 0ifi<0or i >3. Hence, c 0 = a 0 b 0 = 2 c 1 = a 0 b 1 + a 1 b 0 = = 14 c 2 = a 0 b 2 + a 1 b 1 + a 2 b 0 = = 26 c 3 = a 0 b 3 + a 1 b 2 + a 2 b 1 + b 3 a 0 = = 31 c 4 = a 1 b 3 + a 2 b 2 + a 3 b 1 = = 59 c 5 = a 2 b 3 + a 3 b 2 = = 21 c 6 = a 3 b 3 = 42 c 7 = 0 j=0
8 Vertices 1 and 7 are in the same component: there is a directed cycle Vertices 3 and 4 are in the same component: there is a directed cycle Vertices 8, 9, 10 re each in distinct components: the cycle in can be extended to include 8 (using instead of 7 5). This cannot be extended to include { 3, 4, 10 } since there are no edges directed into this set from any any of the other vertices: thus A = {3,4,10} and B = {1,2,5,6,7,8} are in separate components. It now follows that 9 must also be in a component distinct from A and B: 9has no edges directed into A, and no edges directed from B. Satisfiability Instance: Boolean expression, F( X n )over aset of Boolean variables X n = < x 1, x 2,...,x n >. Question: Is there an assignment, α, of Boolean values to the variables X n under which F( α )istrue? 3 Colouring Instance: n-vertex undirected graph G( V, E ). Question: Can each vertex of G be assigned one of 3 available colours, in such a way that no two vertices joined by an edge in E receive the same colour? Hamiltonian Cycle Instance: n-vertex undirected graph G( V, E ). Question: Is there an ordering, π :{1,2,...,n} {1,2,...,n} of the vertices such that i (1 i<n) {π(i), π (i + 1) } E { π (1), π (n)} E i.e. does G contain a simple cycle that includes each vertex?
9 5. Let F k (x) denote the DFT of a k-vector x and Fk 1 (x) the inverse DFT. To compute the convolution of a and b. i. Form the 2n-vectors a 0n = [ a 0,...,a n 1,0,0,...,0] b 0n =[b 0,...,b n 1,0,0,...,0] ii. Compute x = F 2n ( a 0n )and y = F 2n ( b 0n ). iii. Form the 2n-vector z = [ z 0,...,z 2n 1 in which z i = x i * y i. iv. Return the 2n-vector F2n( 1 z )asthe convolution of a and b. Given x = [x 0, x 1, x 2, x 3 ] = [4, 5, 8, 6 ]. Step 1: Form the 2-vectors x02 = [x 0, x 2 ] = [4, 8] and x 13 = [x 1, x 3 ] = [5, 6]. Step 2: Recursively compute a 01 = DFT (x 02,2,4 2 )Since arithmetic is performed modulo 17, 4 2 = 16 = 1. a 01 = [ a 0, a 1 ] = [x 0 + x 2, x 0 x 2 ] Hence, a 01 = [4+8, 4 8]=[12, 4]. Step 3: Recursively compute b 01 = DFT (x 13,2,4 2 )Since arithmetic is performed modulo 17, 4 2 = 16 = 1. b 01 = [ b 0, b 1 ] = [x 1 + x 3, x 1 x 3 ] Hence, b 01 = [5+6, 5 6]=[11, 1]. Step 4: Combine a 01 and b 01 to give the 4-vector y = [y 0, y 1, y 2, y 3 ] = DFT (x,4,4). [ y 0, y 2 ] = [ a 0 + b 0, a 0 b 0 ] Giving [ y 0, y 2 ] = [12+11, ] = [6,1] [y 1,y 3 ]=[a 1 +ωb 1,a 1 ωb 1 ] Giving [ y 1, y 3 ] = [ 4 4, 4 + 4]=[ 8, 0 ] So that DFT ([4, 5, 8, 6], 4, 4) = [6, 8, 1, 0]. The number of bit operations relies critically on the value ω underpinning the computation. Working modulo some value M, this must satisfy ω n/2 = 1for n-bit values (technically ω is a primitive n th root of unity in the ring of integers modulo M). In binary M can be chosen as 2 k + 1(kapower of 2) so that ω is a power of 2. This reduces the cost of operations (at bit level) since just shifting is involved. To parallel this process in decimal operations would require very large values of M, and ω. M = 10 k + 1with k apower of 10. For similar operations on decimal representations 9
10 10 6. A connected, undirected graph G(V, E) contains an Eulerian Tour if and only every vertex ofghas even degree (> 0), i.e. is the end-point of an even number of edges. The partial tour, T 7 = <{7,6},{6,2},{2,1},{1,7},{7,8},{8,10},{10, 7 } > does not contain every edge of G. Find the first vertex ont 7,for which there is some adjacent edge not included in T 7.(Vertex 6). Find a partial tour (T 6 )that contains all of those edges adjacent to 6 that do not occur in T 7.For example T 6 = <{6, 9}, {9, 10}, {10, 4}, {4, 3}, {3, 1}, {1, 4}, {4, 5}, {5, 6} > T 6 can be inserted into T 7 between the edges { 7, 6 } and { 6, 2 }. giving a partial tour T 6,7. The unused edges remaining in G form the graph, Vertex 9isthe first vertex encountered in T 6,7 which has unused edges adjacent to it. The partial tour T 9 = <{9, 4}, {4, 2}, {2, 5}, {5, 9} > can be inserted between the edges {6, 9} and {9, 10} of T 6,7 to give the completed Eulerian Tour. The suggested algorithm fails in general because many graphs are not the image of some graph using the edge-dual transformation, i.e. the graph H for which Ĥ = G does not exist. This is both for Hamiltonian and non-hamiltonian G, e.g.
11 SAT instances require all clauses to contain exactly 3 literals. Thus the clauses: (x 1 ), (x 2 x 8 ), ( x 3 x 4 x 5 x 7 ) and ( x 1 x 2 x 4 x 5 x 6 x 7 )ornot of the correct form. The first stage is to replace the unit clause ( x 1 )by4clauses (x 1 z 1 z 2 ) (x 1 z 1 z 2 ) (x 1 z 1 z 2 ) (x 1 z 1 z 2 ) with { z 1, z 2 }being new variables. Then replace the 2 literal clause ( x 2 x 8 )bythe 2 clauses ( x 2 x 8 z 3 ) ( x 2 x 8 z 3 ) The clause ( x 3 x 4 x 5 x 7 )isreplaced by ( x 3 x 4 z 4 ) ( x 5 x 7 z 4 ) The clause ( x 1 x 2 x 4 x 5 x 6 x 7 )by ( x 1 x 2 z 5 ) (x 4 z 5 z 6 ) (x 6 x 7 z 6 ) The final clauses - ( x 4 x 5 x 7 ) and ( x 4 x 7 x 8 ) - require no changes since these already contain 3 literals. Given F( X n ) = m C j an instance of 3 SAT,aninstance ( G F,8,9) j=1 of PART 3 SAT is formed as follows: G F uses n + 3m variables and has 9m clauses, G F ( X n, Z 3m ) = F( X n ) m 1 H k ( Z k ) the sub-formula H k consists of all eight possible clauses over the variables Z k = { z 3k+1, z 3k+2, z 3k+3 }. An assignment to Z 3m can satisfy at most 7m of the clauses in m 1 H k k=0 thus if the instance ( G F,8,9) of PART 3 SAT is true then there must be an assignment to X n that satisfies all m clauses in F, i.e. F is satisfiable. On the other hand, if F( X n )issatisfiable, then setting z i = false for each 1 i 3m will satisfy all but the clauses ( z 3k+1 z 3k+2 z 3k+3 )and so exactly 8m of the 9m clauses in G F are satisfied, i.e. the instance ( G F,8,9) of PART 3 SAT is true. k=0
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 information1 Introduction. 1. Prove the problem lies in the class NP. 2. Find an NP-complete problem that reduces to it.
1 Introduction There are hundreds of NP-complete problems. For a recent selection see http://www. csc.liv.ac.uk/ ped/teachadmin/comp202/annotated_np.html Also, see the book M. R. Garey and D. S. Johnson.
More informationBest 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 informationPart II. Graph Theory. Year
Part II Year 2017 2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2017 53 Paper 3, Section II 15H Define the Ramsey numbers R(s, t) for integers s, t 2. Show that R(s, t) exists for all s,
More informationFINAL 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 informationTraveling 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 information8.1 Polynomial-Time Reductions
8.1 Polynomial-Time Reductions Classify Problems According to Computational Requirements Q. Which problems will we be able to solve in practice? A working definition. Those with polynomial-time algorithms.
More informationNP-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 informationChapter 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 information1 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 information11/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 informationChapter 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 informationNP-Complete Reductions 2
x 1 x 1 x 2 x 2 x 3 x 3 x 4 x 4 12 22 32 CS 447 11 13 21 23 31 33 Algorithms NP-Complete Reductions 2 Prof. Gregory Provan Department of Computer Science University College Cork 1 Lecture Outline NP-Complete
More informationChapter 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 informationALGORITHMS EXAMINATION Department of Computer Science New York University December 17, 2007
ALGORITHMS EXAMINATION Department of Computer Science New York University December 17, 2007 This examination is a three hour exam. All questions carry the same weight. Answer all of the following six questions.
More informationNP-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 informationGreedy 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! 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 informationW4231: Analysis of Algorithms
W4231: Analysis of Algorithms 11/23/99 NP-completeness of 3SAT, Minimum Vertex Cover, Maximum Independent Set, Boolean Formulae A Boolean formula is an expression that we can build starting from Boolean
More informationChapter 10 Part 1: Reduction
//06 Polynomial-Time Reduction Suppose we could solve Y in polynomial-time. What else could we solve in polynomial time? don't confuse with reduces from Chapter 0 Part : Reduction Reduction. Problem X
More informationComputability Theory
CS:4330 Theory of Computation Spring 2018 Computability Theory Other NP-Complete Problems Haniel Barbosa Readings for this lecture Chapter 7 of [Sipser 1996], 3rd edition. Sections 7.4 and 7.5. The 3SAT
More information14 More Graphs: Euler Tours and Hamilton Cycles
14 More Graphs: Euler Tours and Hamilton Cycles 14.1 Degrees The degree of a vertex is the number of edges coming out of it. The following is sometimes called the First Theorem of Graph Theory : Lemma
More information8 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 informationSteven 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 informationP 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! 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 Chapter 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
More informationCS161 - Final Exam Computer Science Department, Stanford University August 16, 2008
CS161 - Final Exam Computer Science Department, Stanford University August 16, 2008 Name: Honor Code 1. The Honor Code is an undertaking of the students, individually and collectively: a) that they will
More informationFaculty of Science FINAL EXAMINATION COMP-250 A Introduction to Computer Science School of Computer Science, McGill University
NAME: STUDENT NUMBER:. Faculty of Science FINAL EXAMINATION COMP-250 A Introduction to Computer Science School of Computer Science, McGill University Examimer: Prof. Mathieu Blanchette December 8 th 2005,
More informationComputational 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 informationarxiv: v2 [cs.cc] 29 Mar 2010
On a variant of Monotone NAE-3SAT and the Triangle-Free Cut problem. arxiv:1003.3704v2 [cs.cc] 29 Mar 2010 Peiyush Jain, Microsoft Corporation. June 28, 2018 Abstract In this paper we define a restricted
More information1 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 informationUnit 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 informationChapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 Algorithm Design Patterns and Anti-Patterns Algorithm design patterns.
More informationP = NP; P NP. Intuition of the reduction idea:
1 Polynomial Time Reducibility The question of whether P = NP is one of the greatest unsolved problems in the theoretical computer science. Two possibilities of relationship between P and N P P = NP; P
More informationDiscrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 8
CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 8 An Introduction to Graphs Formulating a simple, precise specification of a computational problem is often a prerequisite
More informationP 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 informationDiscrete Mathematics for CS Spring 2008 David Wagner Note 13. An Introduction to Graphs
CS 70 Discrete Mathematics for CS Spring 2008 David Wagner Note 13 An Introduction to Graphs Formulating a simple, precise specification of a computational problem is often a prerequisite to writing a
More informationU.C. Berkeley CS170 : Algorithms, Fall 2013 Midterm 1 Professor: Satish Rao October 10, Midterm 1 Solutions
U.C. Berkeley CS170 : Algorithms, Fall 2013 Midterm 1 Professor: Satish Rao October 10, 2013 Midterm 1 Solutions 1 True/False 1. The Mayan base 20 system produces representations of size that is asymptotically
More informationDiscrete Mathematics and Probability Theory Fall 2013 Vazirani Note 7
CS 70 Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 7 An Introduction to Graphs A few centuries ago, residents of the city of Königsberg, Prussia were interested in a certain problem.
More informationAdvanced Methods in Algorithms HW 5
Advanced Methods in Algorithms HW 5 Written by Pille Pullonen 1 Vertex-disjoint cycle cover Let G(V, E) be a finite, strongly-connected, directed graph. Let w : E R + be a positive weight function dened
More informationP -vs- NP. NP Problems. P = polynomial time. NP = non-deterministic polynomial time
P -vs- NP NP Problems P = polynomial time There are many problems that can be solved correctly using algorithms that run in O(n c ) time for some constant c. NOTE: We can say that an nlogn algorithm is
More informationExample of a Demonstration that a Problem is NP-Complete by reduction from CNF-SAT
20170926 CNF-SAT: CNF-SAT is a problem in NP, defined as follows: Let E be a Boolean expression with m clauses and n literals (literals = variables, possibly negated), in which - each clause contains only
More informationP 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 informationModule 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 informationNP 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 information2SAT Andreas Klappenecker
2SAT Andreas Klappenecker The Problem Can we make the following boolean formula true? ( x y) ( y z) (z y)! Terminology A boolean variable is a variable that can be assigned the values true (T) or false
More informationDiscrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1
CS 70 Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1 PRINT Your Name:, (last) READ AND SIGN The Honor Code: As a member of the UC Berkeley community, I act with honesty,
More information9.1 Cook-Levin Theorem
CS787: Advanced Algorithms Scribe: Shijin Kong and David Malec Lecturer: Shuchi Chawla Topic: NP-Completeness, Approximation Algorithms Date: 10/1/2007 As we ve already seen in the preceding lecture, two
More informationNP Completeness. Andreas Klappenecker [partially based on slides by Jennifer Welch]
NP Completeness Andreas Klappenecker [partially based on slides by Jennifer Welch] Overview We already know the following examples of NPC problems: SAT 3SAT We are going to show that the following are
More information8.1 Polynomial-Time Reductions
Algorithm Design Patterns and Anti-Patterns Analysis of Algorithms Algorithm design patterns. Ex. Greed. O(n 2 ) Dijkstra s SSSP (dense) Divide-and-conquer. O(n log n) FFT. Dynamic programming. O(n 2 )
More informationExercises 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 informationCME 305: Discrete Mathematics and Algorithms Instructor: Reza Zadeh HW#3 Due at the beginning of class Thursday 02/26/15
CME 305: Discrete Mathematics and Algorithms Instructor: Reza Zadeh (rezab@stanford.edu) HW#3 Due at the beginning of class Thursday 02/26/15 1. Consider a model of a nonbipartite undirected graph in which
More informationMassachusetts Institute of Technology Department of Electrical Engineering and Computer Science Algorithms For Inference Fall 2014
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.438 Algorithms For Inference Fall 2014 Recitation-6: Hardness of Inference Contents 1 NP-Hardness Part-II
More informationThe Vertex Cover Problem. Shangqi Wu Presentation of CS 525 March 11 th, 2016
The Vertex Cover Problem Shangqi Wu Presentation of CS 525 March 11 th, 2016 Vertex-Cover Problem Definition If G is an undirected graph, a vertex cover of G is a subset of nodes where every edge of G
More informationLinear Time Unit Propagation, Horn-SAT and 2-SAT
Notes on Satisfiability-Based Problem Solving Linear Time Unit Propagation, Horn-SAT and 2-SAT David Mitchell mitchell@cs.sfu.ca September 25, 2013 This is a preliminary draft of these notes. Please do
More informationNP-Completeness of 3SAT, 1-IN-3SAT and MAX 2SAT
NP-Completeness of 3SAT, 1-IN-3SAT and MAX 2SAT 3SAT The 3SAT problem is the following. INSTANCE : Given a boolean expression E in conjunctive normal form (CNF) that is the conjunction of clauses, each
More information1. Suppose you are given a magic black box that somehow answers the following decision problem in polynomial time:
1. Suppose you are given a magic black box that somehow answers the following decision problem in polynomial time: Input: A CNF formula ϕ with n variables x 1, x 2,..., x n. Output: True if there is an
More informationPaths, Flowers and Vertex Cover
Paths, Flowers and Vertex Cover Venkatesh Raman M. S. Ramanujan Saket Saurabh Abstract It is well known that in a bipartite (and more generally in a König) graph, the size of the minimum vertex cover is
More informationMathematics and Statistics, Part A: Graph Theory Revision Exercises: Sheet 3
Mathematics and Statistics, Part A: Graph Theory Revision Exercises: Sheet 3 1. Prove Caley s theorem. There are n n 2 distinct labelled trees on n vertices. (i) Sketch a tree with 11 edges and find the
More informationDigital Signal Processing. Soma Biswas
Digital Signal Processing Soma Biswas 2017 Partial credit for slides: Dr. Manojit Pramanik Outline What is FFT? Types of FFT covered in this lecture Decimation in Time (DIT) Decimation in Frequency (DIF)
More informationCS 512, Spring 2017: Take-Home End-of-Term Examination
CS 512, Spring 2017: Take-Home End-of-Term Examination Out: Tuesday, 9 May 2017, 12:00 noon Due: Wednesday, 10 May 2017, by 11:59 am Turn in your solutions electronically, as a single PDF file, by placing
More informationThe Complexity of Camping
The Complexity of Camping Marzio De Biasi marziodebiasi [at] gmail [dot] com July 2012 Version 0.04: a re-revised sketch of the proof Abstract We prove that the tents puzzle game is NP -complete using
More informationReductions. Linear Time Reductions. Desiderata. Reduction. Desiderata. Classify problems according to their computational requirements.
Desiderata Reductions Desiderata. Classify problems according to their computational requirements. Frustrating news. Huge number of fundamental problems have defied classification for decades. Desiderata'.
More informationTheorem 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 informationProve, where is known to be NP-complete. The following problems are NP-Complete:
CMPSCI 601: Recall From Last Time Lecture 21 To prove is NP-complete: Prove NP. Prove, where is known to be NP-complete. The following problems are NP-Complete: SAT (Cook-Levin Theorem) 3-SAT 3-COLOR CLIQUE
More informationLecture 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 informationRandomness and Computation March 25, Lecture 5
0368.463 Randomness and Computation March 25, 2009 Lecturer: Ronitt Rubinfeld Lecture 5 Scribe: Inbal Marhaim, Naama Ben-Aroya Today Uniform generation of DNF satisfying assignments Uniform generation
More informationMidterm 2 Solutions. CS70 Discrete Mathematics for Computer Science, Fall 2007
CS70 Discrete Mathematics for Computer Science, Fall 007 Midterm Solutions Note: These solutions are not necessarily model answers Rather, they are designed to be tutorial in nature, and sometimes contain
More informationGraph Algorithms. Tours in Graphs. Graph Algorithms
Graph Algorithms Tours in Graphs Graph Algorithms Special Paths and Cycles in Graphs Euler Path: A path that traverses all the edges of the graph exactly once. Euler Cycle: A cycle that traverses all the
More informationCS 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 informationNP-Hard (A) (B) (C) (D) 3 n 2 n TSP-Min any Instance V, E Question: Hamiltonian Cycle TSP V, n 22 n E u, v V H
Hard Problems What do you do when your problem is NP-Hard? Give up? (A) Solve a special case! (B) Find the hidden parameter! (Fixed parameter tractable problems) (C) Find an approximate solution. (D) Find
More informationLecture 7: Counting classes
princeton university cos 522: computational complexity Lecture 7: Counting classes Lecturer: Sanjeev Arora Scribe:Manoj First we define a few interesting problems: Given a boolean function φ, #SAT is the
More informationCPS 102: Discrete Mathematics. Quiz 3 Date: Wednesday November 30, Instructor: Bruce Maggs NAME: Prob # Score. Total 60
CPS 102: Discrete Mathematics Instructor: Bruce Maggs Quiz 3 Date: Wednesday November 30, 2011 NAME: Prob # Score Max Score 1 10 2 10 3 10 4 10 5 10 6 10 Total 60 1 Problem 1 [10 points] Find a minimum-cost
More informationDiscrete Mathematics Course Review 3
21-228 Discrete Mathematics Course Review 3 This document contains a list of the important definitions and theorems that have been covered thus far in the course. It is not a complete listing of what has
More informationNP-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 informationProblem Set 3 Solutions
Design and Analysis of Algorithms February 29, 2012 Massachusetts Institute of Technology 6.046J/18.410J Profs. Dana Moshovitz and Bruce Tidor Handout 10 Problem Set 3 Solutions This problem set is due
More informationHomework 4 Solutions
CS3510 Design & Analysis of Algorithms Section A Homework 4 Solutions Uploaded 4:00pm on Dec 6, 2017 Due: Monday Dec 4, 2017 This homework has a total of 3 problems on 4 pages. Solutions should be submitted
More informationAPPROXIMATION ALGORITHMS FOR GEOMETRIC PROBLEMS
APPROXIMATION ALGORITHMS FOR GEOMETRIC PROBLEMS Subhas C. Nandy (nandysc@isical.ac.in) Advanced Computing and Microelectronics Unit Indian Statistical Institute Kolkata 70010, India. Organization Introduction
More informationReference 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 informationEngineering 9867 Advanced Computing Concepts
Engineering 9867 Advanced Computing Concepts Assignment #2 Sample solutions Due: Tuesday, April 2 at 9. [ points] Consider the following implementation of the palindrome checking problem (question 4 on
More informationExam 3 Practice Problems
Exam 3 Practice Problems HONOR CODE: You are allowed to work in groups on these problems, and also to talk to the TAs (the TAs have not seen these problems before and they do not know the solutions but
More informationSolutions to Midterm 2 - Monday, July 11th, 2009
Solutions to Midterm - Monday, July 11th, 009 CPSC30, Summer009. Instructor: Dr. Lior Malka. (liorma@cs.ubc.ca) 1. Dynamic programming. Let A be a set of n integers A 1,..., A n such that 1 A i n for each
More informationSAT-CNF Is N P-complete
SAT-CNF Is N P-complete Rod Howell Kansas State University November 9, 2000 The purpose of this paper is to give a detailed presentation of an N P- completeness proof using the definition of N P given
More informationComplexity of Disjoint Π-Vertex Deletion for Disconnected Forbidden Subgraphs
Journal of Graph Algorithms and Applications http://jgaa.info/ vol. 18, no. 4, pp. 603 631 (2014) DOI: 10.7155/jgaa.00339 Complexity of Disjoint Π-Vertex Deletion for Disconnected Forbidden Subgraphs Jiong
More information31.6 Powers of an element
31.6 Powers of an element Just as we often consider the multiples of a given element, modulo, we consider the sequence of powers of, modulo, where :,,,,. modulo Indexing from 0, the 0th value in this sequence
More informationINSTITUTE OF AERONAUTICAL ENGINEERING
INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad -500 043 INFORMATION TECHNOLOGY TUTORIAL QUESTION BANK Course Name : DESIGN AND ANALYSIS OF ALGORITHMS Course Code : AIT001 Class
More informationLecture 10 October 7, 2014
6.890: Algorithmic Lower Bounds: Fun With Hardness Proofs Fall 2014 Lecture 10 October 7, 2014 Prof. Erik Demaine Scribes: Fermi Ma, Asa Oines, Mikhail Rudoy, Erik Waingarten Overview This lecture begins
More informationA Simplied NP-complete MAXSAT Problem. Abstract. It is shown that the MAX2SAT problem is NP-complete even if every variable
A Simplied NP-complete MAXSAT Problem Venkatesh Raman 1, B. Ravikumar 2 and S. Srinivasa Rao 1 1 The Institute of Mathematical Sciences, C. I. T. Campus, Chennai 600 113. India 2 Department of Computer
More informationDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK Module 1 OBJECTIVE: Algorithms play the central role in both the science and the practice of computing. There are compelling reasons to study algorithms.
More informationReductions and Satisfiability
Reductions and Satisfiability 1 Polynomial-Time Reductions reformulating problems reformulating a problem in polynomial time independent set and vertex cover reducing vertex cover to set cover 2 The Satisfiability
More informationLecture 21: Other Reductions Steven Skiena
Lecture 21: Other Reductions Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.stonybrook.edu/ skiena Problem of the Day Show that the dense
More informationComplexity of unique list colorability
Complexity of unique list colorability Dániel Marx 1 Department of Computer Science and Information Theory, Budapest University of Technology and Economics, Budapest H-151, Hungary. Abstract Given a list
More informationIntroduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14
600.363 Introduction to Algorithms / 600.463 Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14 23.1 Introduction We spent last week proving that for certain problems,
More informationLecture 21: Other Reductions Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY
Lecture 21: Other Reductions Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Problem of the Day Show that the Dense
More informationModule 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 informationOn Covering a Graph Optimally with Induced Subgraphs
On Covering a Graph Optimally with Induced Subgraphs Shripad Thite April 1, 006 Abstract We consider the problem of covering a graph with a given number of induced subgraphs so that the maximum number
More informationCS521 \ 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 informationAlgorithm Design and Analysis
Algorithm Design and Analysis LECTURE 16 Dynamic Programming (plus FFT Recap) Adam Smith 9/24/2008 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Discrete Fourier Transform
More informationSome 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 informationFinal 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