Exercises Computational Complexity

Size: px
Start display at page:

Download "Exercises Computational Complexity"

Transcription

1 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 have the same size. For convenience denote the smallest pancake by 1, the second smallest by 2, etc. The only permissible operation on the stack of pancakes is as follows: Insert a spatula between 2 pancakes or between the bottom pancake and the surface, then rotate the pancakes above the spatula. Give an algorithm that sorts any stack of n pancakes (smallest at the top largest at the bottom) with at most poly(n) many flips = A solution for this example: Exercise 2. Show that TIME(f(n)) TIME(n + εf(n)) for every f : N N and every ε > 0. We use multitape Turing machines. Why do we need to add n to εf(n)? (Hint: simulate any machine by an other machine with a large enough alphabet that encodes several tape-cells in one cell.) Exercise 3. Show that P and NP are closed under intersection, union and star operator. (Hint: the hardest part is to show that P is closed under the star operator. Use dynamic programming, i.e., the technique in the proof of Theorem 7.16.) Ex and Exercise 4. Show that subset sum in unary notation is in P, i.e., show that Unary SUBSET- SUM= {1 t #1 w 1 #... #1 wn : x {0, 1} n : t = x i w i } is in P. Ex Exercise 5. Show that if P = NP, then all languages A P, except A = and A = Σ, are NP-complete. Ex Date: March 22, Many exercises are copied or copied with small variations from the book Introduction to the theory of computation by Michael Sipser. 1

2 Exercise 6. Show that if P = NP, then there exists an algorithm that on input a Boolean formula φ decides whether φ is satisfiable, and if it is satisfiable, returns an assignment of the variables that makes φ true. Moreover, the algorithm runs in time polynomial in the size of φ. (Note that with this technique, one can compute certificates for any problem in NP.) A variant of ex Exercise 7. Let CNF k be the set { φ : φ is a satisfiable cnf-formula where each variable appears in at most k places}. (This is not the same kcnf, where each term has at most k literals.) Show that CNF 2 P. Show that CNF 3 is NP-complete. Exercise* 8. Let OneSAT be the set of cnf-formula for which an assignment exists for which each clause contains exactly one true literal. Prove that OneSAT is NP-complete. Let One3SAT be the set of 3cnf-formula for which such an assignment exists. Show that also One3SAT is NP-complete. Exercise 9. A colouring of a graph is an assignment of colours to nodes so that no two nodes that are connected by an edge have the same colour. Let 3COLOUR be the set of such graphs. Show that 3COLOUR is NP-complete. (Hint: Let the 3 colours be T, F and N. Interpret the first as True and False, and represent them on a palette.) Ex F T palette N variable OR-gadget Exercise 10. Consider the following scheduling problem. You are given a list of final exams F 1,..., F k to be scheduled, and a list of students S 1,..., S l. Each student is taking some specified subset of these exams. You must schedule each exam into exactly one slot such that no student is required to take two exams in the same slot. The problem is to determine if such a schedule exists that uses only h slots. Formulate this problem as a language and show that it is NP-complete. Ex Exercise 11. In the following solitaire game, you are given an m m board. On each of its m 2 positions lies either a green stone, a red stone, or nothing at all. You play by removing stones from the board. You win if each column contains only stones of a single colour and each row contains at least one stone. Winning may or may not be possible depending upon the initial configuration. Prove that the set of winnable game configurations is NP-complete. Ex

3 Exercise* 12. Let f be a function for which f(n) o(n log n). Show that all languages that can be decided in time f(n) are regular. Ex Exercise 13. This problem investigates resolution, a method for proving the unsatisfiability of cnf-formulas. Let φ = C 1 C 2 C m be a formula in cnf, where C i are its clauses. Let C = {C 1,..., C m }. In a resolution step we take two clauses C a and C b in C such that some variable occurs positively in C a and negatively in C b. Thus C a = (x y 1 y 2 y k ) and C b = (x z 1 z 2 z l ). We form the new clause (y 1 y k z 1 z l ) and remove repeated literals. Add this new clause to C. Repeat the resolution steps until no additional clauses can be obtained. If the empty clause () is in C, then declare φ unsatisfiable. Show that resolution is sound, i.e., it never declares satisfiable formulas to be unsatisfiable. Show that resolution is complete, i.e., every unsatisfiable formula is declared to be unsatisfiable A 2CNF -formula is a conjunction of clauses of 2 variables. Let 2SAT be the set of satisfiable 2CNF -formulas. Show that 2SAT P. 2 Chapter 8: Space complexity Exercise 14. A ladder is a sequence in of strings s 1, s 2,..., s k such that each strings differs from the previous one by replacing exactly one character. For example: Let LADDER DFA be head, hear, near, bear, beer, deer, deed, feed, feet, fret, free { M, s, e : M is a DFA and L(M) contains a ladder starting in s and ending in e}. Show that this set is in PSPACE. Ex Exercise 15. Show that if A PSPACE, then A PSPACE. Part of Ex Exercise 16. Show that if every NP-hard language is also PSPACE-hard, then NP = PSPACE. Ex Exercise 17. Show that TQBF restricted to the formulas where the part following the quantifiers is in 3CNF form is still PSPACE-complete. Ex Exercise 18. Let A LBA = { M, w : M is a linear bounded automaton that accepts w}. Show that A LBA is PSPACE-complete. Ex Exercise 19. Two Boolean formulas are equivalent if they have the same set of variables and are true on the same set of assignments to those variables (i.e., they describe the same Boolean function). A Boolean formula is minimal if no shorter Boolean function is equivalent to it. Let MIN -FORMULA be the collection of minimal Boolean formulas. 3

4 Show that MIN -FORMULA PSPACE. Explain why this argument fails to show that MIN -FORMULA conp: If φ MIN -FORMULA, then φ has a smaller equivalent formula. A non-deterministic Turing machine can verify that φ MIN -FORMULA. Ex Exercise 20. In exercise 17 you showed that the set of TQBF in 3CNF -form is PSPACEcomplete. Now, consider Boolean formula that have no negations, i.e., formula that are constructed with only AND and OR operations. Such formula are called monotone. { } x 1 x 2... x 2n 1 x 2n Φ(x 1,..., x 2n ) : Φ is a monotone Boolean formula Do one of the following things: (a) show that this set is in P or (b) show that it is PSPACEcomplete. Hint: think about why these formula are called monotone? Exercise 21. Exercise Exercise* 22. In the game generalized geography, two players alternate turns and construct a single path in a directed graph. A player looses if he can not extend the end of the path with a vertex that does not belong to the path. In a variant of this game, both players alternate turns and each player constructs his own path. A player looses if in his turn he can not extend his path with a vertex that does not appear in his and the other players path. Let GG be the set of triples (G, a, b) where the first player has a winning strategy in the modified geography game when he starts in vertex a and the second player starts in vertex b. Show that GG is PSPACE-complete. Hint: There are several solutions. It might help to note that the reduction for GG works with arbitrary Boolean formula. Rewrite a given Boolean formula such that it is build from literals, OR operations, and binary AND operations. The basic ideas are similar from the construction of GG, but the forall player can one of the options while the exist player goes through an AND-gate. Exercise 23. During the lectures, it was shown that (directed) Generalized Geography is PSPACE-complete. Surprisingly, the undirected variant is in P. The goal of the exercise is to prove this. In the game undirected vertex geography two players alternate moves and construct together a single path in an undirected graph. Initially, the beginning and the end of the path coincide with a given start vertex s. At his turn a player should select a vertex that is connected with the end of the path and that does not already appear in the path. This vertex becomes the new end of the path. A player looses if he can not select such a neighbouring vertex. Let UVG be the set of pairs (G, s) where G is a graph and the first player has a winning strategy when he starts playing. A matching in a graph is a set of edges without common neighbours, i.e., no pair of edges is incident on a common vertex. A maximum matching is a matching of maximal cardinality. Show that the first player has a winning strategy in the game (G, s) if and only if every maximum matching has an edge that is incident on s. There exists an algorithm, called Blossom algorithm, that computes the maximal size of a matching in a graph in polynomial time. Assume you can use this algorithm. Use it to construct an algorithm that decides UVG in polynomial time 4

5 Exercise 24. The cat-and-mouse game is played by two players, Cat and Mouse, on an arbitrary undirected graph. At a given point each player occupies a vertex of the graph. The players take turns moving to a vertex adjacent to the one that they currently occupy. A special vertex of the graph is called Hole. Cat wins if the two players ever occupy the same vertex. He looses if Mouse reaches the Hole before the preceding happens. He also looses if a situation repeats (i.e., the two players simultaneously occupy positions that they simultaneously occupied previously and it is the same player s turn to move). Let HAPPY -CAT be the set of quadruples (G, c, m, h) such that G is a graph, and c, m and h are the positions of Cat, Mouse and Whole, for which Cat has a winning strategy if he moves first. Show that HAPPY -CAT P. Hint: the solution is not too hard. Ex Chapter 9: Intractability Exercise 25. What is the error in the following fallacious argument that P NP? Assume that P = NP, then SAT P and so for some k, SAT TIME(n k ). Therefore P TIME(n k ). But by the time hierarchy theorem, TIME(n k+1 ) contains a language not in TIME(n k ), which contradicts P TIME(n k ). Therefore P NP. Ex Exercise 26. Consider the function pad : Σ N (Σ {#}) defined by pad(s, l) = s# j with j = max(0, l s ). For any language A and any function f, let pad(a, f) be the language of elements pad(x, f( x )) for all x A. Prove that A TIME(n 6 ), then pad(a, n 2 ) TIME(n 3 ). If NEXPTIME EXPTIME, then P NP. P SPACE(n 2 ). Ex Exercise 27. Let L be the language over the alphabet A = {a, b} that contains all strings that start with at most N symbols a, in other words L = ɛ ba aba aaba a N ba. This is a regular expression with exponentiation. Give a more compact regular expression with exponentiation that uses a single union operation. Exercise 28. Define the USAT problem to be { φ : φ is a Boolean formula that has a single satisfying assignment} Show that USAT P SAT. Ex Exercise 29. Consider the set { φ : φ SAT and the lexicographically first x 1... x n for which φ(x 1,..., x n ) is true, has x n = 0}. Show that this set is in P SAT. 5

6 Exercise 30. Let MIN -FORMULA be the language defined in exercise 19. Show that the complement of this language is in NP SAT. Exercise 31. Show that if P SAT = NP then NP = conp. Ex Exercise 32. Let P A,1 be the class of languages that can be decided in polynomial time with oracle A, but for which for each input, the machine makes at most one query on the oracle. Show that NP conp P SAT,1, If NP conp, then NP conp P SAT,1. Ex Exercise 33. Define a language L to be downward-self-reducible if there is a polynomial-time algorithm R that for any n and x Σ n, decides whether x L using the oracle L n 1, which solves membership of L for inputs of size at most n 1. In other words, R L n 1 (x) = L(x) for all n and all x of length n. Prove that if L is downward-self-reducible, then L PSPACE. (From the previous edition of Sipser s book.) Exercise 34. Imagine you are given two oracles and one of them is the set TQBF. You don t know which one. Design an algorithm that can access the two oracles A and B and that decides TQBF in polynomial time. Ex Exercise 35. Adapt the proof of Theorem 9.20 to show that there exists a decidable set B such that conp B NP B. Ex Exercise* 36. Suppose we generate a random language B in the following way: for every n, with probability 1/2, B has no strings of length n, and with probability 1/2 we pick a random string to be in B. Show that for each ε > 0 we have that P B NP B with probability at least 1 ε. 4 Chapter 10: Advanced topics Exercise 37. Show that if NP BP P, then NP = RP. Ex Exercise 38. Show that: The parity function for n-bit strings can be computed by a branching program of size O(n). Ex The majority function for n-bit strings, i.e., the function x n i=1 x i > n/2, can be computed by a branching program of size O(n 2 ). Ex Any function on n-bit strings can be computed by branching programs of size 2 n. Ex Exercise 39. Show that if A is a regular language, then a family of branching programs B 1, B 2,... exists such that B n accepts exactly the n-bit strings in A and the size of B n is bounded by a constant times n. Ex Exercise 40. Let EQ BP be the set of pairs (B 1, B 2 ) of equivalent branching programs. Show that EQ BP is conp-complete. Ex

8.1 Polynomial-Time Reductions

8.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 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

More on Polynomial Time and Space

More on Polynomial Time and Space CpSc 8390 Goddard Fall15 More on Polynomial Time and Space 20.1 The Original NP-Completeness Proof A configuration/snapshot of a machine is a representation of its current state (what info would be needed

More information

9.1 Cook-Levin Theorem

9.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 information

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

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 Algorithm Design Patterns and Anti-Patterns Algorithm design patterns.

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

Computability Theory

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

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

CS 151 Complexity Theory Spring Final Solutions. L i NL i NC 2i P.

CS 151 Complexity Theory Spring Final Solutions. L i NL i NC 2i P. CS 151 Complexity Theory Spring 2017 Posted: June 9 Final Solutions Chris Umans 1. (a) The procedure that traverses a fan-in 2 depth O(log i n) circuit and outputs a formula runs in L i this can be done

More information

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18 601.433/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18 22.1 Introduction We spent the last two lectures proving that for certain problems, we can

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

8.1 Polynomial-Time Reductions

8.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 information

USING QBF SOLVERS TO SOLVE GAMES AND PUZZLES. Zhihe Shen. Advisor: Howard Straubing

USING QBF SOLVERS TO SOLVE GAMES AND PUZZLES. Zhihe Shen. Advisor: Howard Straubing Boston College Computer Science Senior Thesis USING QBF SOLVERS TO SOLVE GAMES AND PUZZLES Zhihe Shen Advisor: Howard Straubing Abstract There are multiple types of games, such as board games and card

More information

W4231: Analysis of Algorithms

W4231: 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 information

ALGORITHMS EXAMINATION Department of Computer Science New York University December 17, 2007

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

Reductions and Satisfiability

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

Complexity Classes and Polynomial-time Reductions

Complexity Classes and Polynomial-time Reductions COMPSCI 330: Design and Analysis of Algorithms April 19, 2016 Complexity Classes and Polynomial-time Reductions Lecturer: Debmalya Panigrahi Scribe: Tianqi Song 1 Overview In this lecture, we introduce

More information

NP versus PSPACE. Frank Vega. To cite this version: HAL Id: hal https://hal.archives-ouvertes.fr/hal

NP versus PSPACE. Frank Vega. To cite this version: HAL Id: hal https://hal.archives-ouvertes.fr/hal NP versus PSPACE Frank Vega To cite this version: Frank Vega. NP versus PSPACE. Preprint submitted to Theoretical Computer Science 2015. 2015. HAL Id: hal-01196489 https://hal.archives-ouvertes.fr/hal-01196489

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

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14

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

arxiv: v2 [cs.cc] 29 Mar 2010

arxiv: 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 information

6.045J/18.400J: Automata, Computability and Complexity Final Exam. There are two sheets of scratch paper at the end of this exam.

6.045J/18.400J: Automata, Computability and Complexity Final Exam. There are two sheets of scratch paper at the end of this exam. 6.045J/18.400J: Automata, Computability and Complexity May 18, 2004 6.045 Final Exam Prof. Nancy Lynch Name: Please write your name on each page. This exam is open book, open notes. There are two sheets

More information

The Complexity of Camping

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

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

CS 580: Algorithm Design and Analysis

CS 580: Algorithm Design and Analysis CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 2018 Homework 4: Due tomorrow (March 9) at 11:59 PM Recap Linear Programming Very Powerful Technique (Subject of Entire Courses)

More information

3/7/2018. CS 580: Algorithm Design and Analysis. 8.1 Polynomial-Time Reductions. Chapter 8. NP and Computational Intractability

3/7/2018. CS 580: Algorithm Design and Analysis. 8.1 Polynomial-Time Reductions. Chapter 8. NP and Computational Intractability Algorithm Design Patterns and Anti-Patterns CS 580: Algorithm Design and Analysis Jeremiah Blocki Purdue University Spring 2018 Algorithm design patterns. Ex. Greedy. O(n log n) interval scheduling. Divide-and-conquer.

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

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 Introduction. 1. Prove the problem lies in the class NP. 2. Find an NP-complete problem that reduces to it.

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

6.045 Final Exam. Name: Please write your name on each page. This exam is open book, open notes.

6.045 Final Exam. Name: Please write your name on each page. This exam is open book, open notes. 6.045J/18.400J: Automata, Computability and Complexity May 18, 2004 6.045 Final Exam Prof. Nancy Lynch, Nati Srebro Susan Hohenberger Please write your name on each page. This exam is open book, open notes.

More information

NP Completeness. Andreas Klappenecker [partially based on slides by Jennifer Welch]

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

Reductions. Linear Time Reductions. Desiderata. Reduction. Desiderata. Classify problems according to their computational requirements.

Reductions. 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 information

1. [5 points each] True or False. If the question is currently open, write O or Open.

1. [5 points each] True or False. If the question is currently open, write O or Open. University of Nevada, Las Vegas Computer Science 456/656 Spring 2018 Practice for the Final on May 9, 2018 The entire examination is 775 points. The real final will be much shorter. Name: No books, notes,

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

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

Lecture 14: Lower Bounds for Tree Resolution

Lecture 14: Lower Bounds for Tree Resolution IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Advanced Course on Computational Complexity Lecture 14: Lower Bounds for Tree Resolution David Mix Barrington and Alexis Maciel August

More information

Finding a winning strategy in variations of Kayles

Finding a winning strategy in variations of Kayles Finding a winning strategy in variations of Kayles Simon Prins ICA-3582809 Utrecht University, The Netherlands July 15, 2015 Abstract Kayles is a two player game played on a graph. The game can be dened

More information

Fixed Parameter Algorithms

Fixed Parameter Algorithms Fixed Parameter Algorithms Dániel Marx Tel Aviv University, Israel Open lectures for PhD students in computer science January 9, 2010, Warsaw, Poland Fixed Parameter Algorithms p.1/41 Parameterized complexity

More information

Solutions for the Exam 6 January 2014

Solutions for the Exam 6 January 2014 Mastermath and LNMB Course: Discrete Optimization Solutions for the Exam 6 January 2014 Utrecht University, Educatorium, 13:30 16:30 The examination lasts 3 hours. Grading will be done before January 20,

More information

CMPSCI611: The SUBSET-SUM Problem Lecture 18

CMPSCI611: The SUBSET-SUM Problem Lecture 18 CMPSCI611: The SUBSET-SUM Problem Lecture 18 We begin today with the problem we didn t get to at the end of last lecture the SUBSET-SUM problem, which we also saw back in Lecture 8. The input to SUBSET-

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

PCP and Hardness of Approximation

PCP and Hardness of Approximation PCP and Hardness of Approximation January 30, 2009 Our goal herein is to define and prove basic concepts regarding hardness of approximation. We will state but obviously not prove a PCP theorem as a starting

More information

2SAT Andreas Klappenecker

2SAT 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 information

CS 512, Spring 2017: Take-Home End-of-Term Examination

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

PSPACE Problems. The Class PSPACE. PSPACE Problems are interesting since: They form the first interesting class potentially

PSPACE Problems. The Class PSPACE. PSPACE Problems are interesting since: They form the first interesting class potentially PSPACE Problems Space Complexity: If an algorithm A solves a problem X by using O(f(n)) bits of memory where n is the size of the input we say that X SPACE(f(n)). The Class PSPACE Def: X PSPACE if and

More information

W[1]-hardness. Dániel Marx 1. Hungarian Academy of Sciences (MTA SZTAKI) Budapest, Hungary

W[1]-hardness. Dániel Marx 1. Hungarian Academy of Sciences (MTA SZTAKI) Budapest, Hungary W[1]-hardness Dániel Marx 1 1 Institute for Computer Science and Control, Hungarian Academy of Sciences (MTA SZTAKI) Budapest, Hungary School on Parameterized Algorithms and Complexity Będlewo, Poland

More information

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

Where Can We Draw The Line?

Where Can We Draw The Line? Where Can We Draw The Line? On the Hardness of Satisfiability Problems Complexity 1 Introduction Objectives: To show variants of SAT and check if they are NP-hard Overview: Known results 2SAT Max2SAT Complexity

More information

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

W[1]-hardness. Dániel Marx. Recent Advances in Parameterized Complexity Tel Aviv, Israel, December 3, 2017

W[1]-hardness. Dániel Marx. Recent Advances in Parameterized Complexity Tel Aviv, Israel, December 3, 2017 1 W[1]-hardness Dániel Marx Recent Advances in Parameterized Complexity Tel Aviv, Israel, December 3, 2017 2 Lower bounds So far we have seen positive results: basic algorithmic techniques for fixed-parameter

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

Theory of Computations Spring 2016 Practice Final Exam Solutions

Theory of Computations Spring 2016 Practice Final Exam Solutions 1 of 8 Theory of Computations Spring 2016 Practice Final Exam Solutions Name: Directions: Answer the questions as well as you can. Partial credit will be given, so show your work where appropriate. Try

More information

Lecture 21: Other Reductions Steven Skiena

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

Complexity of unique list colorability

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

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

COMP260 Spring 2014 Notes: February 4th

COMP260 Spring 2014 Notes: February 4th COMP260 Spring 2014 Notes: February 4th Andrew Winslow In these notes, all graphs are undirected. We consider matching, covering, and packing in bipartite graphs, general graphs, and hypergraphs. We also

More information

Online Ramsey Theory

Online Ramsey Theory Charles University in Prague Faculty of Mathematics and Physics MASTER THESIS Pavel Dvořák Online Ramsey Theory Computer Science Institute of Charles University Supervisor of the master thesis: Study programme:

More information

Umans Complexity Theory Lectures

Umans Complexity Theory Lectures Introduction Umans Complexity Theory Lectures Lecture 5: Boolean Circuits & NP: - Uniformity and Advice, - NC hierarchy Power from an unexpected source? we know P EXP, which implies no polytime algorithm

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

1. 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: 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 information

Examples of P vs NP: More Problems

Examples of P vs NP: More Problems Examples of P vs NP: More Problems COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2017 Catch Up / Drop in Lab When Fridays, 15.00-17.00 Where N335, CSIT Building (bldg 108)

More information

14.1 Encoding for different models of computation

14.1 Encoding for different models of computation Lecture 14 Decidable languages In the previous lecture we discussed some examples of encoding schemes, through which various objects can be represented by strings over a given alphabet. We will begin this

More information

1 Undirected Vertex Geography UVG

1 Undirected Vertex Geography UVG Geography Start with a chip sitting on a vertex v of a graph or digraph G. A move consists of moving the chip to a neighbouring vertex. In edge geography, moving the chip from x to y deletes the edge (x,

More information

The Resolution Algorithm

The Resolution Algorithm The Resolution Algorithm Introduction In this lecture we introduce the Resolution algorithm for solving instances of the NP-complete CNF- SAT decision problem. Although the algorithm does not run in polynomial

More information

Randomness and Computation March 25, Lecture 5

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

Example of a Demonstration that a Problem is NP-Complete by reduction from CNF-SAT

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

CS154, Lecture 18: PCPs, Hardness of Approximation, Approximation-Preserving Reductions, Interactive Proofs, Zero-Knowledge, Cold Fusion, Peace in

CS154, Lecture 18: PCPs, Hardness of Approximation, Approximation-Preserving Reductions, Interactive Proofs, Zero-Knowledge, Cold Fusion, Peace in CS154, Lecture 18: PCPs, Hardness of Approximation, Approximation-Preserving Reductions, Interactive Proofs, Zero-Knowledge, Cold Fusion, Peace in the Middle East There are thousands of NP-complete problems

More information

Copyright 2000, Kevin Wayne 1

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

More information

P -vs- NP. NP Problems. P = polynomial time. NP = non-deterministic polynomial time

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

Theory Bridge Exam Example Questions Version of June 6, 2008

Theory Bridge Exam Example Questions Version of June 6, 2008 Theory Bridge Exam Example Questions Version of June 6, 2008 This is a collection of sample theory bridge exam questions. This is just to get some idea of the format of the bridge exam and the level of

More information

On Covering a Graph Optimally with Induced Subgraphs

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

SAT-CNF Is N P-complete

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

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 3.2, 3.3 Define variants of TMs Enumerators Multi-tape TMs Nondeterministic TMs

More information

Linear Time Unit Propagation, Horn-SAT and 2-SAT

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

Chapter 10 Part 1: Reduction

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

An IPS for TQBF Intro to Approximability

An IPS for TQBF Intro to Approximability An IPS for TQBF Intro to Approximability Outline Proof that TQBF (the language of true (valid) quantified Boolean formulas) is in the class IP Introduction to approximation algorithms for NP optimization

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

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,, CMPSCI 601: Recall From Last Time Lecture 5 Definition: A context-free grammar (CFG) is a 4- tuple, variables = nonterminals, terminals, rules = productions,,, are all finite. 1 ( ) $ Pumping Lemma for

More information

6.006 Introduction to Algorithms. Lecture 25: Complexity Prof. Erik Demaine

6.006 Introduction to Algorithms. Lecture 25: Complexity Prof. Erik Demaine 6.006 Introduction to Algorithms Lecture 25: Complexity Prof. Erik Demaine Today Reductions between problems Decision vs. optimization problems Complexity classes P, NP, co NP, PSPACE, EXPTIME, NP completeness

More information

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1} CSE 5 Homework 2 Due: Monday October 6, 27 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments in

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

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

Boolean Functions (Formulas) and Propositional Logic

Boolean Functions (Formulas) and Propositional Logic EECS 219C: Computer-Aided Verification Boolean Satisfiability Solving Part I: Basics Sanjit A. Seshia EECS, UC Berkeley Boolean Functions (Formulas) and Propositional Logic Variables: x 1, x 2, x 3,, x

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

5. Lecture notes on matroid intersection

5. Lecture notes on matroid intersection Massachusetts Institute of Technology Handout 14 18.433: Combinatorial Optimization April 1st, 2009 Michel X. Goemans 5. Lecture notes on matroid intersection One nice feature about matroids is that a

More information

1. Provide two valid strings in the languages described by each of the following regular expressions, with alphabet Σ = {0,1,2}.

1. Provide two valid strings in the languages described by each of the following regular expressions, with alphabet Σ = {0,1,2}. 1. Provide two valid strings in the languages described by each of the following regular expressions, with alphabet Σ = {0,1,2}. (a) 0(010) 1 (b) (21 10) 0012 (c) 1 (200) 100 01 Examples: 1, 200, 111,

More information

A New Reduction from 3-SAT to Graph K- Colorability for Frequency Assignment Problem

A New Reduction from 3-SAT to Graph K- Colorability for Frequency Assignment Problem A New Reduction from 3-SAT to Graph K- Colorability for Frequency Assignment Problem Prakash C. Sharma Indian Institute of Technology Survey No. 113/2-B, Opposite to Veterinary College, A.B.Road, Village

More information

Problem set 2. Problem 1. Problem 2. Problem 3. CS261, Winter Instructor: Ashish Goel.

Problem set 2. Problem 1. Problem 2. Problem 3. CS261, Winter Instructor: Ashish Goel. CS261, Winter 2017. Instructor: Ashish Goel. Problem set 2 Electronic submission to Gradescope due 11:59pm Thursday 2/16. Form a group of 2-3 students that is, submit one homework with all of your names.

More information