Efficient and Not-So-Efficient Algorithms. NP-Complete Problems. Search Problems. Propositional Logic. DPV Chapter 8: NP-Complete Problems, Part 1

Size: px
Start display at page:

Download "Efficient and Not-So-Efficient Algorithms. NP-Complete Problems. Search Problems. Propositional Logic. DPV Chapter 8: NP-Complete Problems, Part 1"

Transcription

1 Efficient and Not-So-Efficient Algoritms NP-Complete Problems DPV Capter 8: NP-Complete Problems, Part 1 Jim Royer EECS November 24, 2009 Problem spaces tend to be big: A grap on n vertices can ave up to n n 2 spanning trees. A grap on n vertices can ave Θ(2 n ) many pats between verts s and t. Etc. Te Good News In our previous work, out of wit Θ(2 n ) (or worse) many coices, we ave found te rigt answer in time O(n k ) for some k. Te Bad News Not all are so nice. Uncredited diagrams are from DPV or omemade. NP-Completeness 1 / 1 NP-Completeness 2 / 1 Searc Problems Propositional Logic Searc are tose of te form: Given:... Find:... (wit a large searc space) Satfiability (as a searc problem) Given: A boolean formula in conjunctive normal form (CNF). Find: A satfying assignment for it (if it as one). We need to define some terms. Te formulas of propositional logic are given by te grammar: P ::= Var P P P P P Var ::= te syntactic category of variables A trut assignment a function I : Variables { False, True }. A trut assignment I determines te value of a formula as follows: I[[x]] = True iff I(x) = True (x a variable) I[[ p]] = True iff I[[p]] = False I[[p q]] = True iff I[[p]] = I[[q]] = True. I[[p q]] = True iff I[[p]] = True or I[[q]] = True. A satfying assignment for a formula p an I wit I[[p]] = True. Te only known algoritms for SAT run in exponential time. NP-Completeness 3 / 1 NP-Completeness 4 / 1

2 Conjunctive Normal Form Back to Searc Problems, 1 Instead of writing x we write x. A variable x and te negation of a variable x are called literals. A clause a djunction of literals. E.g.: (x y z). A conjunctive normal form formula a conjunction of clauses. E.g.: (x y z) (x y) (y z) (z x) (x y z) Satfiability (as a searc problem) Given: A boolean formula in conjunctive normal form (CNF). Find: A satfying assignment for it (if it as one). Note te differences wit te boolean circuit evaluation problem. If a CNF formula as n variables, tere are 2 n possible assignments. Elements of a Searc Problem I: an instance of te problem S: a possible solution for I C : (Instances) (Pot. Solutions) { True, False } C(I, S) = te result of cecking if S solves I C sould be computable in O( I k ) for some k. (T implies tat S cannot be too large.) For SAT: An instance : a CNF formula (x y) (y x) A pot. solution : a trut assignment x True, y True poly-time cecker : boolean circuit evaluation NP-Completeness 5 / 1 NP-Completeness 6 / 1 Back to Searc Problems, 2 Elements of a Searc Problem I: an instance of te problem S: a possible solution for I C : (Instances) (Pot. Solutions) { True, False } C(I, S) = te result of cecking if S solves I C sould be computable in O( I k ) for some k. (T implies tat S cannot be too large.) Variations of SAT Horn Clause SAT Easy (Capter 5) 2SAT Easy 3SAT Hard, it seems nsat te restricted version of SAT in wic eac clause as at most n literals. NP-Completeness 7 / 1 Traveling Salesman Traveling Salesman (TS) as a searc problem Given: n vertices and all n (n 1)/2-many dtances between tem b a budget (number) Find: An ordering of 1,..., n: π(1), π(2),..., π(n) (a tour) so tat d π(1),π(2) + d π(2),π(3) + + d π(n),π(1) b. Traveling Salesman (TS) as an optimization problem Given: n vertices and all n (n 1)/2-many dtances between tem. Find: An ordering of 1,..., n: π(1), π(2),..., π(n) so tat te tour s cost d π(1),π(2) + d π(2),π(3) + + d π(n),π(1) minimal. Te two are equivalent: A solution to te optimization problem, solves te searc problem. (Wy?) Given a way to solve te searc problem, you can construct a solution to te optimization problem via binary searc. (How?) Te only known algoritms for tese are exponential time. TS a restriction of te Minimal Spanning Tree problem in wic te MST allowed no brances. NP-Completeness 8 / 1

3 Euler and Hamiltonian Pats, 1 Euler and Hamiltonian Pats, 2 A pat in an undirected grap an Euler pat wen it uses eac edge of te grap exactly once. (Te pat may pass troug a vertex many times.) If te pat a cycle, ten it called an Euler Tour or an Euler Circuit. A pat in an undirected grap a Rudrata pat (or more usually a Hamiltonian pat) wen it uses eac vertex of te grap exactly once. If te pat a cycle, ten it called a Rudrata Cycle or Hamiltonian Cycle. Teorem (Euler) G as an Euler pat G connected and as at most two vertices of odd degree. No Euler Pat Euler Tour: A B... K Images from: ttp://en.wikipedia.org/wiki/eulerian_pat NP-Completeness 9 / 1 Image from: ttp://en.wikipedia.org/wiki/hamiltonian_pat Tere a nice poly-time algoritm for te Euler Pat Searc problem. (See ttp://en.wikipedia.org/wiki/eulerian_pat.) All known algoritms for te Hamiltonian Pat Searc Problem are exponential-time. NP-Completeness 10 / 1 Cuts and bections Integer Linear Programming A cut in a grap a set of edges wic, if removed, dconnect te grap. A minimum cut a cut of smallest size. Minimum Cut Problem Given: An undirected grap G and a budget b (a number), Find: A cut of G of at most b edges. Balanced Cut Problem Given: An undirected grap G = (V, E) and a budget b (a number), Find: A partition of V: S and T wit S, T V /3 suc tat te number of edges between S and T at most b. You can use Ford-Fulkerson to solve Min-Cut in poly-time. Te only known algoritms for Balanced-Cut are exponential time. Balanced-Cuts are important in clustering. (See DPV.) Integer Linear Programming (ILP) Given: constraints A x b and objective function ct x and goal: g Find: A vector of integers x satfying A x b and ct x g. or equivalently Given: constraints A x b Find: A vector of integers x satfying A x b. ( c T x g incorporated into te constraints.) Zero-One Equations (ZOE) Given: constraints A x b Find: A vector of 0 s and 1 s x satfying A x b. ILP and ZOE sow up in lots of optimization work. Te only known algoritms for Balanced-Cut are exponential time. Image from: ttp://en.wikipedia.org/wiki/cut_(grap_teory) NP-Completeness 11 / 1 NP-Completeness 12 / 1

4 Tree-dimensional matcing Independent set, vertex cover, and clique, 1 3D Matcing Given: R A B C were A = B = C = n. Find: A subset M R of n many triples suc tat if (a, b, c) and (a, b, c ) are dtinct elements of M, ten a = a, b = b, and c = c. 2D matcing poly-time (via Ford-Fulkerson). S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani 255 Figure 8.4 A more elaborate matcmaking scenario. Eac triple sown as a triangularsaped node joining boy, girl, and pet. Al Bob Cet Armadillo Alice Bobcat Canary Te only known algoritms for 3D Matcing are exponential time. Beatrice Carol complete our story we will introduce a few more ard, wic will play a role later in te capter, wen we relate te computational difficulty of all tese. Te reader invited to skip aead to Section 8.2 and ten return to te definitions of tese as required. Tree-dimensional matcing Recall te BIPARTITE MATCHING problem: given a bipartite grap wit n nodes on eac side (te boys and te girls), find a set of n djoint edges, or decide tat no suc set exts. In Section 7.3, we saw ow to efficiently solve t problem by a reduction to maximum flow. However, tere an interesting generalization, called 3D MATCHING, for wic no polynomial algoritm known. In t new setting, tere are n boys and n girls, but also n pets, NP-Completeness and te compatibilities 13 / 1 among tem are specified by a set of triples, eac containing a boy, a girl, and a pet. Intuitively, a triple (b, g, p) means tat boy b, girl g, and pet p get along well togeter. We want to find n djoint triples and tereby create n armonious ouseolds. Can you spot a solution in Figure 8.4? Independent set, vertex cover, and clique, 2 Suppose G = (V, E) an undirected grap and U V. (a) U independent wen for eac u, v U, (u, v) / E. Independent set, vertex cover, and clique In te INDEPENDENT SET problem (recall Section 6.7) we are given a grap and an integer g, and te aim to find g vertices tat are independent, tat, no two of wic ave an edge between tem. Can you find an independent set of tree vertices in Figure 8.5? How about four vertices? We saw in Section 6.7 tat t problem can be solved efficiently on trees, but for general graps no polynomial algoritm known. Tere are many oter searc about graps. In VERTEX COVER, for example, te input a grap and a budget b, and te idea to find b vertices tat cover (touc) every edge. Can you cover all edges of Figure 8.5 wit seven vertices? Wit six? (And do you see te (b) U a vertex cover wen eac edge of E as at least one endpoint in U. (c) U a clique wen for eac dtinct u, v U, (u, v) E. Independent Set Problem Find: An independent set for G of size b. Vertex Cover Problem Find: A vertex cover for G of size b. Clique Problem Find: A clique in G of size b. Suppose G = (V, E) an undirected grap and U V. (a) U independent wen for eac u, v U, (u, v) / E. (b) U a vertex cover wen eac edge of E as at least one endpoint in U. (c) U a clique wen for eac dtinct u, v U, (u, v) E. Te blue vertices are a max-sized independent set for te grap. Te red vertices are a min-sized vertex cover for te grap. Te images are from Wikipedia. NP-Completeness 14 / 1 Independent set, vertex cover, and clique, 3 Independent Set Problem Find: An independent set for G of size b. Vertex Cover Problem Find: A vertex cover for G of size b. Clique Problem Find: A clique in G of size b. Te red vertices are a max-sized clique for te grap. Te only known algoritms for tese are exponential time. NP-Completeness 15 / 1 NP-Completeness 16 / 1

5 Longest Pat, Knapsack, Subset Sum In sort, te world full of searc, some of wic can be solved efficiently oters seem to Problems: be very ard. Hard T and depicted Easyin te following table. Te Longest Pat Problem Given: A undirected grap G. Find: A longest simple pat in G. (Simple pat a pat wit no repeated vertices.) Knapsack Given: Weigts w 1,..., w n, values v 1,..., v n, Total Capacity: W, and Goal: G (all positive integers). Find: A selection of items wit total weigt W and total value G. Subset Sum Given: A multet of integers M and goal G. Find: An { x 1,..., x k } M suc tat G = x x k. NP-Completeness 17 / 1 Hard (NP-complete) Easy (in P) 3SAT TRAVELING SALESMAN PROBLEM LONGEST PATH 3D MATCHING KNAPSACK INDEPENDENT SET INTEGER LINEAR PROGRAMMING RUDRATA PATH BALANCED CUT 2SAT, HORN SAT MINIMUM SPANNING TREE SHORTEST PATH BIPARTITE MATCHING UNARY KNAPSACK INDEPENDENT SET on trees LINEAR PROGRAMMING EULER PATH MINIMUM CUT All of te ard above are ard for te same reason. T table wort contemplating. On te rigt we ave tat can be Te only known algoritms for tese are exponential time. In fact, tey are all te same problem in dgue. efficiently. On te left, we ave a bunc of ard nuts tat ave escaped efficient soluti?? But didn t we ave an LP solution to Knapsack? Yes, but... many decades or centuries. NP-Completeness 18 / 1 P and NP, 1 Recall: Elements of a Searc Problem I: an instance of te problem S: a possible solution for I C : (Instances) (Pot. Solutions) { True, False } C(I, S) = te result of cecking if S solves I C sould be computable in O( I k ) for some k. (T implies tat S cannot be too large.) (NP and P: As searc ) (a) An efficient cecking algoritm an algoritm tat computes C as above in O( I k )-time for some k. (b) Eac efficient cecking algoritm C determines a searc problem: S a solution for I C(I, S) = True. (c) NP = te class of all searc tat ave eff. cecking algoritms. (d) P = te class of all searc for wic one can find solutions (or determine tere are none) in polynomial time. NP-Completeness 19 / 1 P and NP, 2 A decion problem a problem wit an Yes/No answer. SAT as a decion problem: Does CNF formula F ave satfying assignment? Hamiltonian Pat as a decion problem: Does G ave a Hamiltonian Pat? (NP and P: As decion ) (a) NP = te class of all decion tat ave eff. cecking algoritms. (b) P = te class of all decion tat ave polytime algoritms. In Algoritms: searc are a bit more natural tan decion. In Computational Complexity Teory: te reverse Wic better? Te searc and decion forms of NP are rougly of equivalent ardness. Te $1,000,000,000 Question: P? = NP. Collect your prize ere: ttp:// Q: Wat te bas for believing all tose we just lted are ard? NP-Completeness 20 / 1

6 efficient algoritm (besides, of course, te torical fact tat many clever matematicians and computer scientts ave tried ard and failed to find any)? Suc evidence provided by reductions, Formalizing wic translate Reductions, one searc problem 1 into anoter. Wat tey demonstrate tat te on te left side of te table are all, in some sense, exactly te same problem, except tat tey are stated in different languages. Wat s more, we will also use reductions to sowreducing tat tese A are tote problem ardest B searc reprasing A in NP if B s language even one of tem as a polynomial E.g., Te time reprasing algoritm, te tenboolean every problem CircuitinEval NPProblem as a polynomial as an LPtime problem. algoritm. Tus if we believe tat P NP, ten all tese searc are ard. We defined reductions in Capter 7 and saw many examples of tem. Let s now specialize t definition to searc. A reduction from searc problem A to searc problem B A problem A reducible to problem B (written: A B [DPV] or A B [tese a polynomial-time algoritm f tat transforms any instance I of A into an instance f(i) of B, togeter slides]) wit wen anoter tere polynomial-time are two polytime algoritm computable tat functions maps any f and solution S of f(i) back S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani 259 into a solution f transforms (S) of I; an seea-instance te following I into diagram. a B-instance If f(i) f as (I). no solution, ten neiter does I. Tese two transforms translationa procedures B-solutionfS and of f (I) imply for into tatan anya-solution algoritm(s) for Bof can I be converted tat into an P algoritm NP te for task A by of bracketing finding a it proof between for a f given and. matematical assertion a searc problem and terefore in NP (after all, wen a formal proof of a matematical statement written out in excruciating detail, Algoritm it can be cecked for A mecanically, line by line, by an efficient algoritm). So if P = NP, tere would be an efficient metod to prove any teorem, tus eliminating te need for matematicians! All insolution all, tere S of f(i) are a variety of Solution reasons wy it Instance Instance f(i) Algoritm widely believed (S) of I I tat f P NP. However, proving t as turned out to be extremely difficult, one of te deepest and most importantfor unsolved B puzzles of matematics. Reductions, again No solution to f(i) No solution to I Even And if now we accept we cantat finally P define NP, te wat class about of te te ardest specific searc. on te left side of te table? On te bas of wat evidence do we believe tat tese particular ave no A searc problem NP-complete NP-Completeness if all oter searc 21 / 1 efficient algoritm (besides, of course, te torical fact tat many reduce clever to it. matematicians and computer scientts ave tried ard and failed to find any)? Suc evidence provided T by reductions, a very strong wic requirement translate one indeed. searc For problem a problem into to anoter. be NP-complete, Wat tey it demonstrate must be useful in tat solving te every searc on te problem left side of in te te table world! are It all, in remarkable some sense, tat exactly suc te same problem, ext. except But tey Formalizing tat do, tey and are te stated firstreductions, column in different of te languages. table 3 we Wat s saw earlier more, we filled will wit also use te reductions most famous to sow examples. tat tese In Section 8.3 we are sall te see ardest ow searc all tese in reduce NP if to even one one anoter, of tem and as also a polynomial wy all oter time searc algoritm, ten reduce every to problem tem. in NP as a polynomial time algoritm. Tus if we believe tat P NP, ten all tese searc are ard. We defined reductions in Capter 7 and saw many examples of tem. Let s now specialize t definition Reductions to searc compose. A reduction from searc problem A to searc problem B a polynomial-time I.e., A Balgoritm and B Cf implies tat transforms tat A any C. instance I of A into an instance f(i) of B, togeter If wit A Banoter and Apolynomial-time NP-ard, tenalgoritm so B. tat maps any solution S of f(i) back into a solution (S) of I; see te following diagram. If f(i) as no solution, ten neiter does I. Tese two If A translation NP-complete procedures and B f and an NP-problem imply tat any wit algoritm A B, for B can be converted into an algoritm ten B for also A by NP-complete. bracketing it between (Wy f and t. andy?) Instance I f Instance f(i) Algoritm for A Algoritm for B Solution S of f(i) No solution to f(i) And now we can finally define te class of te ardest searc. Solution (S) of I No solution to I Even if we accept tat P NP, wat about te specific on te left side of te table? On te bas of wat evidence do we believe tat tese particular ave no efficient algoritm (besides, of course, te torical fact tat many clever matematicians Formalizing Reductions, 2 and computer scientts ave tried ard and failed to find any)? Suc evidence provided by reductions, wic translate one searc problem into anoter. Wat tey demonstrate tat te on te left side of te table are all, in some sense, exactly te same problem, except tat tey are stated in different languages. Wat s more, we will also use reductions to sow(a) tat Atese problem NP-ard are te wen ardest all searc in NP if even one of tem as a polynomial NP- time algoritm, reduceten to it. every problem in NP as a polynomial time algoritm. Tus if we(b) believe A problem tat P NP-complete NP, ten allwen teseit searc are ard. We defined NP and reductions NP-ard. in Capter 7 and saw many examples of tem. Let s now specialize t definition to searc. A reduction from searc problem A to searc problem B a polynomial-time If A B andalgoritm A ard, ften tatsotransforms B. any instance I of A into an instance f(i) of B, togeter (Wy?) wit anoter polynomial-time algoritm tat maps any solution S of f(i) back into a solution (S) of I; see te following diagram. If f(i) as no solution, ten neiter does S. Dasgupta, If AC.H. B and Papadimitriou, B easy, ten and sou.v. I. Tese two translation procedures f and A. Vazirani 259 imply tat any algoritm for B can be converted into an algoritm (Wy?) for A by bracketing it between f and Image. from ttp:// tat P NP te task of finding a proof for a given matematical assertion a searc problem and terefore in NP (after Algoritm all, wen fora Aformal proof of a matematical statement written out in excruciating detail, it can be cecked mecanically, line by line, by an efficient algoritm). So if P = NP, tere would be an efficient Solution Smetod of f(i) to prove Solution any teorem, tus Instance Instance f(i) Algoritm eliminating (S) of I I te need f for matematicians! All in all, tere are a variety of reasons wy it widely believed tat P NP. However, forproving B tno as solution turned to f(i) out to be extremely difficult, No solution to I one of te deepest and most important unsolved puzzles of matematics. Reductions, And now we again can finally define te class of te ardest searc. NP-Completeness 22 / 1 Even if we accept tat P NP, wat about te specific on te left side of te table? A On searc teproblem bas of wat NP-complete evidence do if all weoter believe searc tat tese particular reduce to it. ave no efficient algoritm (besides, of course, te torical fact tat many clever matematicians T a very strong requirement indeed. For a problem to be NP-complete, it must be useful and computer Formalizing scientts ave Reductions, tried ard and4 failed to find any)? Suc evidence provided in solving every searc problem in te world! It remarkable tat suc ext. by reductions, wic translate one searc problem into anoter. Wat tey demonstrate But tey do, and te first column of te table we saw earlier filled wit te most famous tat te on te left side of te table are all, in some sense, exactly te same problem, examples. StepsIninSection proving 8.3 we tat sall asee reduction ow all tese works reduce to one anoter, and also except tat tey are stated in different languages. Wat s more, we will also use reductions to wy all oter searc reduce to tem. sowargue tat tese tat: are te ardest searc in NP if even one of tem as a polynomial time algoritm, ten every problem in NP as a polynomial time algoritm. Tus 1. f and are polytime computable. (Some and waving on t usually OK.) if we believe tat P NP, ten all tese searc are ard. We defined 2. If f (I) reductions as solution in Capter S, ten7 Iand assaw solution many(s). examples of tem. Let s now specialize t definition 3. If f (I) to as searc no solution,. ten A reduction I as nofrom solution. searc problem A to searc problem B a polynomial-time 3 algoritm f tat transforms any instance I of A into an instance f(i) of. If I as a solution, ten f (I) also as solution. B, togeter wit anoter polynomial-time algoritm tat maps any solution S of f(i) back into a solution 3 and (S) 3 are of I; equivalent: see te following (A = diagram. B) If f(i) ( B as = no A). solution, ten neiter does I. Tese two translation However, 3 procedures f and imply tat any algoritm for B can be converted into an algoritm for A byusually bracketing easier it between to prove. f and. Instance I f Instance f(i) Algoritm for A Algoritm for B Solution S of f(i) No solution to f(i) Solution (S) of I No solution to I A searc problem NP-complete if all oter searc reduce to it. NP-Completeness 23 / 1 T a very strong requirement indeed. For a problem to be NP-complete, it must be useful in solving every searc problem in te world! It remarkable tat suc ext. And now we can finally define te class of te ardest searc. NP-Completeness 24 / 1 A searc problem NP-complete if all oter searc reduce to it.

7 Te Plan of 8.3 eductions between searc. All of NP SAT Algoritms Warm up: Rudrata (s, t)-pat Rudrata Cycle Rudrata (s, t)-pat Given: G = (V, E) and s, t V. Find: A pat from s to t in G passing troug eac vertex once. 3SAT INDEPENDENT SET 3D MATCHING VERTEX COVER CLIQUE ZOE SUBSET SUM ILP RUDRATA CYCLE TSP Rudrata Cycle Given: G = (V, E). Find: A cycle in G passing troug eac vertex once. Rudrata (s, t)-pat Rudrata Cycle: Given an instance of Rudrata (s, t)-pat: (G, s, t) construct G by adding an new vertex x and new edges (x, s) and (x, t). If P a Rudrata-cyclc in G, ten leaving x, (x, s) and (x, t) out of P gives an (s, t)-rudrata pat in G. If G as a (s, t)-rudrata pat P, ten adding (x, s) and (x, t) to P yields a Rudrata cycle in G. If G as no Rudrata cycle, ten G as no (s, t)-rudrata pat. NP-Completeness 25 / 1 NP-Completeness 26 / 1 reductions 3SAT Independent Set, 1 see tat te searc of Section 8.1 can be reduced to one anoter as igure 8.7. As a consequence, tey are all NP-complete. e tackle 3SATte specific reductions in te tree, let s warm up by relating two versions Tink circuits, but not too literally. G G 3SAT Independent Set, 2 To build a satfying assignment of an instance of 3SAT, we ave to pick out at least one literal per clause to be TRUE constently! ta problem. Consider: (x y z) (x y z) (x y z) (x y). Given: A CNF formula θ in wic eac clause as at most 3 literals. Find: A satfying assignment for θ. A clause (l 1 l 2 l 3 ) represented by a triangle wit verts labeled: l 1, l 2, & l 3. Idea: If v U an indep. set and v as label l, s, t)-path RUDRATA CYCLE ten te trut assignment corresponding to U sets l to TRUE. Independent Set Problem UDRATA CYCLE problem: given a grap, tere a cycle tat passes troug eac Set g = # of clauses. So any indep. set must ave one vertex from eac triangle. ly once? Given: WeG can = (V, also E) formulate and b. te closely related RUDRATA (s, t)-path problem, (Wy?) Find: An independent set for G of size vertices s and t are specified, and we b. 264 want a pat starting at s and ending at t But we ave to ave constency cecks. We don t want to set x and x to TRUE. Algoritms I.e., Find U V wit U b and ( u, v U)[(u, v) / E]. oug eac vertex exactly once. Is it possible tat RUDRATA CYCLE easier tan So put an edge between eac occurrence of a variable x and eac occurrence of x. Figure 8.8 Te grap corresponding to (x y z) (x y z) (x y z) (x y). T enforces constency. (Wy?), t)-path? We will sow by a reduction tat te answer no. Puzzle: ction maps an instance (G = (V, E), s, t) of RUDRATA (s, t)-path into an instance Tese are very different of RUDRATA CYCLE as follows: G looking. How to we get simply a reduction? G wit an additional vertex x and y y y y es {s, x} and {x, t}. For instance: x z x z x z x s NP-Completeness 27 / 1 s NP-Completeness 28 / 1

8 3SAT Independent Set, 3 Construction: 3SAT instance IS instance Given an instance of 3SAT C 1,..., C k. For eac clause C i = (l 1, l 2, l 3 ), build a triangle wit vertices labeled l 1, l 2, & l 3. Add an edge between eac literal and all of its opposites. Set g = k. Construction: IS solution 3SAT solution Given an independent set U: for eac v U wit label l, set l to TRUE. For eac variable tat does not yet ave a trut value, set it to TRUE. Claim 1: Bot 264 constructions are poly-time. Algoritms Claim 2: Given an indep. set, we can construct a satfying assignment for C 1,..., C k. Claim 3 Figure 8.8 Te grap corresponding to (x y z) (x y z) (x y z) (x y). : If C 1,..., C k as an satfying assignment, ten tere size g indep. set. (x y z) (x y z) (x y z) (x y) y y y y x z x z x z x SAT 3SAT, 1 Construction: SAT instance 3SAT instance Translate eac clause to sequence of clauses. (l 1 l 2 l k ) (l 1 l 2 y 1 ) (y 1 l 3 y 2 ) (y k 3 l k 1 l k ) were k > 3 and y 1,..., y k 3 are new vars. Clauses wit 3 literals translate to temselves. Construction: 3SAT solution SAT solution Take te trut assignment for te 3SAT formula & restrict it to te original vars. Claim 1: Bot constructions are poly-time. Claim 2: If te 3SAT formula as satfying assignment, ten restriction satfies te SAT formula. Claim 3 : If te SAT formula satfiable, so te 3SAT formula. NP-Completeness 29 / 1 NP-Completeness 30 / 1 Let us tink. To form a satfying trut assignment we must pick one literal from eac clause and give it te value true. But our coices must be constent: if we coose x in one clause, we cannot coose x in anoter. Any constent coice of literals, one from eac clause, specifies a trut assignment (variables for wic neiter literal as been cosen can take on eiter value). So, let us represent a clause, say (x y z), by a triangle, wit vertices labeled x, y, z. Wy triangle? Because a triangle as its tree vertices maximally connected, and tus forces us to pick only one of tem for te independent set. Repeat t construction for all clauses a clause wit two literals will be represented simply by an edge joining te literals. (A clause wit one literal silly and can be removed in a preprocessing step, since te value of te variable determined.) In te resulting grap, an independent set as to pick at most one literal from eac group (clause). To force exactly one coice from eac clause, take te goal g to be te number of clauses; in our example, g = 4. All tat msing now a way to prevent us from coosing opposite literals (tat, bot x and x) in different clauses. But t easy: put an edge between any two vertices tat correspond to opposite literals. Te resulting grap for our example sown in Figure 8.8. Let s recap te construction. Given an instance I of 3SAT, we create an instance (G, g) of INDEPENDENT SET as follows. Grap G as a triangle for eac clause (or just an edge, if te clause as two literals), wit vertices labeled by te clause s literals, and as additional edges between any two vertices tat represent opposite literals. Te goal g set to te number of clauses. Clearly, t construction takes polynomial time. However, recall tat for a reduction we do not just need an efficient way to map instances of te first problem to instances of te second (te function f in te diagram on page 259), but also a way to reconstruct a solution to te first instance from any solution of te second (te function ). As always, tere are two tings to sow. 1. Given an independent set S of g vertices in G, it possible to efficiently recover a satfying trut assignment to I.

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

Section 2.3: Calculating Limits using the Limit Laws

Section 2.3: Calculating Limits using the Limit Laws Section 2.3: Calculating Limits using te Limit Laws In previous sections, we used graps and numerics to approimate te value of a it if it eists. Te problem wit tis owever is tat it does not always give

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

Bounding Tree Cover Number and Positive Semidefinite Zero Forcing Number

Bounding Tree Cover Number and Positive Semidefinite Zero Forcing Number Bounding Tree Cover Number and Positive Semidefinite Zero Forcing Number Sofia Burille Mentor: Micael Natanson September 15, 2014 Abstract Given a grap, G, wit a set of vertices, v, and edges, various

More information

MATH 5a Spring 2018 READING ASSIGNMENTS FOR CHAPTER 2

MATH 5a Spring 2018 READING ASSIGNMENTS FOR CHAPTER 2 MATH 5a Spring 2018 READING ASSIGNMENTS FOR CHAPTER 2 Note: Tere will be a very sort online reading quiz (WebWork) on eac reading assignment due one our before class on its due date. Due dates can be found

More information

4.1 Tangent Lines. y 2 y 1 = y 2 y 1

4.1 Tangent Lines. y 2 y 1 = y 2 y 1 41 Tangent Lines Introduction Recall tat te slope of a line tells us ow fast te line rises or falls Given distinct points (x 1, y 1 ) and (x 2, y 2 ), te slope of te line troug tese two points is cange

More information

4.2 The Derivative. f(x + h) f(x) lim

4.2 The Derivative. f(x + h) f(x) lim 4.2 Te Derivative Introduction In te previous section, it was sown tat if a function f as a nonvertical tangent line at a point (x, f(x)), ten its slope is given by te it f(x + ) f(x). (*) Tis is potentially

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

Chapter 8. NP-complete problems. Search problems. cient algorithms. Exponential search space

Chapter 8. NP-complete problems. Search problems. cient algorithms. Exponential search space Chapter 8. NP-complete problems Search problems 1 / 64 2 / 64 E cient algorithms Exponential search space We have developed algorithms for finding shortest paths in graphs, minimum spanning trees in graphs,

More information

3.6 Directional Derivatives and the Gradient Vector

3.6 Directional Derivatives and the Gradient Vector 288 CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES 3.6 Directional Derivatives and te Gradient Vector 3.6.1 Functions of two Variables Directional Derivatives Let us first quickly review, one more time, te

More information

CHAPTER 7: TRANSCENDENTAL FUNCTIONS

CHAPTER 7: TRANSCENDENTAL FUNCTIONS 7.0 Introduction and One to one Functions Contemporary Calculus 1 CHAPTER 7: TRANSCENDENTAL FUNCTIONS Introduction In te previous capters we saw ow to calculate and use te derivatives and integrals of

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

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

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

Numerical Derivatives

Numerical Derivatives Lab 15 Numerical Derivatives Lab Objective: Understand and implement finite difference approximations of te derivative in single and multiple dimensions. Evaluate te accuracy of tese approximations. Ten

More information

2.8 The derivative as a function

2.8 The derivative as a function CHAPTER 2. LIMITS 56 2.8 Te derivative as a function Definition. Te derivative of f(x) istefunction f (x) defined as follows f f(x + ) f(x) (x). 0 Note: tis differs from te definition in section 2.7 in

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

2 The Derivative. 2.0 Introduction to Derivatives. Slopes of Tangent Lines: Graphically

2 The Derivative. 2.0 Introduction to Derivatives. Slopes of Tangent Lines: Graphically 2 Te Derivative Te two previous capters ave laid te foundation for te study of calculus. Tey provided a review of some material you will need and started to empasize te various ways we will view and use

More information

Materials: Whiteboard, TI-Nspire classroom set, quadratic tangents program, and a computer projector.

Materials: Whiteboard, TI-Nspire classroom set, quadratic tangents program, and a computer projector. Adam Clinc Lesson: Deriving te Derivative Grade Level: 12 t grade, Calculus I class Materials: Witeboard, TI-Nspire classroom set, quadratic tangents program, and a computer projector. Goals/Objectives:

More information

You Try: A. Dilate the following figure using a scale factor of 2 with center of dilation at the origin.

You Try: A. Dilate the following figure using a scale factor of 2 with center of dilation at the origin. 1 G.SRT.1-Some Tings To Know Dilations affect te size of te pre-image. Te pre-image will enlarge or reduce by te ratio given by te scale factor. A dilation wit a scale factor of 1> x >1enlarges it. A dilation

More information

NP-complete problems. Chapter Search problems

NP-complete problems. Chapter Search problems Chapter 8 NP-complete problems 8.1 Search problems Over the past seven chapters we have developed algorithms for finding shortest paths and minimum spanning trees in graphs, matchings in bipartite graphs,

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

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

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

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

Multi-Stack Boundary Labeling Problems

Multi-Stack Boundary Labeling Problems Multi-Stack Boundary Labeling Problems Micael A. Bekos 1, Micael Kaufmann 2, Katerina Potika 1 Antonios Symvonis 1 1 National Tecnical University of Atens, Scool of Applied Matematical & Pysical Sciences,

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

More on Functions and Their Graphs

More on Functions and Their Graphs More on Functions and Teir Graps Difference Quotient ( + ) ( ) f a f a is known as te difference quotient and is used exclusively wit functions. Te objective to keep in mind is to factor te appearing in

More information

Announcements. Lilian s office hours rescheduled: Fri 2-4pm HW2 out tomorrow, due Thursday, 7/7. CSE373: Data Structures & Algorithms

Announcements. Lilian s office hours rescheduled: Fri 2-4pm HW2 out tomorrow, due Thursday, 7/7. CSE373: Data Structures & Algorithms Announcements Lilian s office ours resceduled: Fri 2-4pm HW2 out tomorrow, due Tursday, 7/7 CSE373: Data Structures & Algoritms Deletion in BST 2 5 5 2 9 20 7 0 7 30 Wy migt deletion be arder tan insertion?

More information

, 1 1, A complex fraction is a quotient of rational expressions (including their sums) that result

, 1 1, A complex fraction is a quotient of rational expressions (including their sums) that result RT. Complex Fractions Wen working wit algebraic expressions, sometimes we come across needing to simplify expressions like tese: xx 9 xx +, xx + xx + xx, yy xx + xx + +, aa Simplifying Complex Fractions

More information

1.4 RATIONAL EXPRESSIONS

1.4 RATIONAL EXPRESSIONS 6 CHAPTER Fundamentals.4 RATIONAL EXPRESSIONS Te Domain of an Algebraic Epression Simplifying Rational Epressions Multiplying and Dividing Rational Epressions Adding and Subtracting Rational Epressions

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

Haar Transform CS 430 Denbigh Starkey

Haar Transform CS 430 Denbigh Starkey Haar Transform CS Denbig Starkey. Background. Computing te transform. Restoring te original image from te transform 7. Producing te transform matrix 8 5. Using Haar for lossless compression 6. Using Haar

More information

19.2 Surface Area of Prisms and Cylinders

19.2 Surface Area of Prisms and Cylinders Name Class Date 19 Surface Area of Prisms and Cylinders Essential Question: How can you find te surface area of a prism or cylinder? Resource Locker Explore Developing a Surface Area Formula Surface area

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

Piecewise Polynomial Interpolation, cont d

Piecewise Polynomial Interpolation, cont d Jim Lambers MAT 460/560 Fall Semester 2009-0 Lecture 2 Notes Tese notes correspond to Section 4 in te text Piecewise Polynomial Interpolation, cont d Constructing Cubic Splines, cont d Having determined

More information

CSE 332: Data Structures & Parallelism Lecture 8: AVL Trees. Ruth Anderson Winter 2019

CSE 332: Data Structures & Parallelism Lecture 8: AVL Trees. Ruth Anderson Winter 2019 CSE 2: Data Structures & Parallelism Lecture 8: AVL Trees Rut Anderson Winter 29 Today Dictionaries AVL Trees /25/29 2 Te AVL Balance Condition: Left and rigt subtrees of every node ave eigts differing

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

NOTES: A quick overview of 2-D geometry

NOTES: A quick overview of 2-D geometry NOTES: A quick overview of 2-D geometry Wat is 2-D geometry? Also called plane geometry, it s te geometry tat deals wit two dimensional sapes flat tings tat ave lengt and widt, suc as a piece of paper.

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

! 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

Section 1.2 The Slope of a Tangent

Section 1.2 The Slope of a Tangent Section 1.2 Te Slope of a Tangent You are familiar wit te concept of a tangent to a curve. Wat geometric interpretation can be given to a tangent to te grap of a function at a point? A tangent is te straigt

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

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

CS 234. Module 6. October 16, CS 234 Module 6 ADT Dictionary 1 / 33

CS 234. Module 6. October 16, CS 234 Module 6 ADT Dictionary 1 / 33 CS 234 Module 6 October 16, 2018 CS 234 Module 6 ADT Dictionary 1 / 33 Idea for an ADT Te ADT Dictionary stores pairs (key, element), were keys are distinct and elements can be any data. Notes: Tis is

More information

Cubic smoothing spline

Cubic smoothing spline Cubic smooting spline Menu: QCExpert Regression Cubic spline e module Cubic Spline is used to fit any functional regression curve troug data wit one independent variable x and one dependent random variable

More information

12.2 Investigate Surface Area

12.2 Investigate Surface Area Investigating g Geometry ACTIVITY Use before Lesson 12.2 12.2 Investigate Surface Area MATERIALS grap paper scissors tape Q U E S T I O N How can you find te surface area of a polyedron? A net is a pattern

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

Wrap up Amortized Analysis; AVL Trees. Riley Porter Winter CSE373: Data Structures & Algorithms

Wrap up Amortized Analysis; AVL Trees. Riley Porter Winter CSE373: Data Structures & Algorithms CSE 373: Data Structures & Wrap up Amortized Analysis; AVL Trees Riley Porter Course Logistics Symposium offered by CSE department today HW2 released, Big- O, Heaps (lecture slides ave pseudocode tat will

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

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

Linear Interpolating Splines

Linear Interpolating Splines Jim Lambers MAT 772 Fall Semester 2010-11 Lecture 17 Notes Tese notes correspond to Sections 112, 11, and 114 in te text Linear Interpolating Splines We ave seen tat ig-degree polynomial interpolation

More information

12.2 Techniques for Evaluating Limits

12.2 Techniques for Evaluating Limits 335_qd /4/5 :5 PM Page 863 Section Tecniques for Evaluating Limits 863 Tecniques for Evaluating Limits Wat ou sould learn Use te dividing out tecnique to evaluate its of functions Use te rationalizing

More information

5.4 Sum and Difference Formulas

5.4 Sum and Difference Formulas 380 Capter 5 Analtic Trigonometr 5. Sum and Difference Formulas Using Sum and Difference Formulas In tis section and te following section, ou will stud te uses of several trigonometric identities and formulas.

More information

Chapter K. Geometric Optics. Blinn College - Physics Terry Honan

Chapter K. Geometric Optics. Blinn College - Physics Terry Honan Capter K Geometric Optics Blinn College - Pysics 2426 - Terry Honan K. - Properties of Ligt Te Speed of Ligt Te speed of ligt in a vacuum is approximately c > 3.0µ0 8 mês. Because of its most fundamental

More information

Notes: Dimensional Analysis / Conversions

Notes: Dimensional Analysis / Conversions Wat is a unit system? A unit system is a metod of taking a measurement. Simple as tat. We ave units for distance, time, temperature, pressure, energy, mass, and many more. Wy is it important to ave a standard?

More information

Basic Approximation algorithms

Basic Approximation algorithms Approximation slides Basic Approximation algorithms Guy Kortsarz Approximation slides 2 A ρ approximation algorithm for problems that we can not solve exactly Given an NP-hard question finding the optimum

More information

CE 221 Data Structures and Algorithms

CE 221 Data Structures and Algorithms CE Data Structures and Algoritms Capter 4: Trees (AVL Trees) Text: Read Weiss, 4.4 Izmir University of Economics AVL Trees An AVL (Adelson-Velskii and Landis) tree is a binary searc tree wit a balance

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

12.2 TECHNIQUES FOR EVALUATING LIMITS

12.2 TECHNIQUES FOR EVALUATING LIMITS Section Tecniques for Evaluating Limits 86 TECHNIQUES FOR EVALUATING LIMITS Wat ou sould learn Use te dividing out tecnique to evaluate its of functions Use te rationalizing tecnique to evaluate its of

More information

MTH-112 Quiz 1 - Solutions

MTH-112 Quiz 1 - Solutions MTH- Quiz - Solutions Words in italics are for eplanation purposes onl (not necessar to write in te tests or. Determine weter te given relation is a function. Give te domain and range of te relation. {(,

More information

15-122: Principles of Imperative Computation, Summer 2011 Assignment 6: Trees and Secret Codes

15-122: Principles of Imperative Computation, Summer 2011 Assignment 6: Trees and Secret Codes 15-122: Principles of Imperative Computation, Summer 2011 Assignment 6: Trees and Secret Codes William Lovas (wlovas@cs) Karl Naden Out: Tuesday, Friday, June 10, 2011 Due: Monday, June 13, 2011 (Written

More information

All truths are easy to understand once they are discovered; the point is to discover them. Galileo

All truths are easy to understand once they are discovered; the point is to discover them. Galileo Section 7. olume All truts are easy to understand once tey are discovered; te point is to discover tem. Galileo Te main topic of tis section is volume. You will specifically look at ow to find te volume

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

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

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

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

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

Computing geodesic paths on manifolds

Computing geodesic paths on manifolds Proc. Natl. Acad. Sci. USA Vol. 95, pp. 8431 8435, July 1998 Applied Matematics Computing geodesic pats on manifolds R. Kimmel* and J. A. Setian Department of Matematics and Lawrence Berkeley National

More information

CS270 Combinatorial Algorithms & Data Structures Spring Lecture 19:

CS270 Combinatorial Algorithms & Data Structures Spring Lecture 19: CS270 Combinatorial Algorithms & Data Structures Spring 2003 Lecture 19: 4.1.03 Lecturer: Satish Rao Scribes: Kevin Lacker and Bill Kramer Disclaimer: These notes have not been subjected to the usual scrutiny

More information

S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani 241

S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani 241 S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani 241 7.12. For the linear program max x 1 2x 3 x 1 x 2 1 2x 2 x 3 1 x 1, x 2, x 3 0 prove that the solution (x 1, x 2, x 3 ) = (3/2, 1/2, 0) is optimal.

More information

Our Calibrated Model has No Predictive Value: An Example from the Petroleum Industry

Our Calibrated Model has No Predictive Value: An Example from the Petroleum Industry Our Calibrated Model as No Predictive Value: An Example from te Petroleum Industry J.N. Carter a, P.J. Ballester a, Z. Tavassoli a and P.R. King a a Department of Eart Sciences and Engineering, Imperial

More information

6 Computing Derivatives the Quick and Easy Way

6 Computing Derivatives the Quick and Easy Way Jay Daigle Occiental College Mat 4: Calculus Experience 6 Computing Derivatives te Quick an Easy Way In te previous section we talke about wat te erivative is, an we compute several examples, an ten we

More information

The Euler and trapezoidal stencils to solve d d x y x = f x, y x

The Euler and trapezoidal stencils to solve d d x y x = f x, y x restart; Te Euler and trapezoidal stencils to solve d d x y x = y x Te purpose of tis workseet is to derive te tree simplest numerical stencils to solve te first order d equation y x d x = y x, and study

More information

The (, D) and (, N) problems in double-step digraphs with unilateral distance

The (, D) and (, N) problems in double-step digraphs with unilateral distance Electronic Journal of Grap Teory and Applications () (), Te (, D) and (, N) problems in double-step digraps wit unilateral distance C Dalfó, MA Fiol Departament de Matemàtica Aplicada IV Universitat Politècnica

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

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

Hash-Based Indexes. Chapter 11. Comp 521 Files and Databases Spring

Hash-Based Indexes. Chapter 11. Comp 521 Files and Databases Spring Has-Based Indexes Capter 11 Comp 521 Files and Databases Spring 2010 1 Introduction As for any index, 3 alternatives for data entries k*: Data record wit key value k

More information

Areas of Parallelograms and Triangles. To find the area of parallelograms and triangles

Areas of Parallelograms and Triangles. To find the area of parallelograms and triangles 10-1 reas of Parallelograms and Triangles ommon ore State Standards G-MG..1 Use geometric sapes, teir measures, and teir properties to descrie ojects. G-GPE..7 Use coordinates to compute perimeters of

More information

Hardness of Approximation for the TSP. Michael Lampis LAMSADE Université Paris Dauphine

Hardness of Approximation for the TSP. Michael Lampis LAMSADE Université Paris Dauphine Hardness of Approximation for the TSP Michael Lampis LAMSADE Université Paris Dauphine Sep 2, 2015 Overview Hardness of Approximation What is it? How to do it? (Easy) Examples The PCP Theorem What is it?

More information

Lecture 20: Satisfiability Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY

Lecture 20: Satisfiability Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY Lecture 20: Satisfiability 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 Suppose we are given

More information

1 Finding Trigonometric Derivatives

1 Finding Trigonometric Derivatives MTH 121 Fall 2008 Essex County College Division of Matematics Hanout Version 8 1 October 2, 2008 1 Fining Trigonometric Derivatives 1.1 Te Derivative as a Function Te efinition of te erivative as a function

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

VOLUMES. The volume of a cylinder is determined by multiplying the cross sectional area by the height. r h V. a) 10 mm 25 mm.

VOLUMES. The volume of a cylinder is determined by multiplying the cross sectional area by the height. r h V. a) 10 mm 25 mm. OLUME OF A CYLINDER OLUMES Te volume of a cylinder is determined by multiplying te cross sectional area by te eigt. r Were: = volume r = radius = eigt Exercise 1 Complete te table ( =.14) r a) 10 mm 5

More information

Lecture 24: More Reductions (1997) Steven Skiena. skiena

Lecture 24: More Reductions (1997) Steven Skiena.   skiena Lecture 24: More Reductions (1997) Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Prove that subgraph isomorphism

More information

You should be able to visually approximate the slope of a graph. The slope m of the graph of f at the point x, f x is given by

You should be able to visually approximate the slope of a graph. The slope m of the graph of f at the point x, f x is given by Section. Te Tangent Line Problem 89 87. r 5 sin, e, 88. r sin sin Parabola 9 9 Hperbola e 9 9 9 89. 7,,,, 5 7 8 5 ortogonal 9. 5, 5,, 5, 5. Not multiples of eac oter; neiter parallel nor ortogonal 9.,,,

More information

CS211 Spring 2004 Lecture 06 Loops and their invariants. Software engineering reason for using loop invariants

CS211 Spring 2004 Lecture 06 Loops and their invariants. Software engineering reason for using loop invariants CS211 Spring 2004 Lecture 06 Loops and teir invariants Reading material: Tese notes. Weiss: Noting on invariants. ProgramLive: Capter 7 and 8 O! Tou ast damnale iteration and art, indeed, ale to corrupt

More information

8/6/2010 Assignment Previewer

8/6/2010 Assignment Previewer Week 4 Friday Homework (1321979) Question 1234567891011121314151617181920 1. Question DetailsSCalcET6 2.7.003. [1287988] Consider te parabola y 7x - x 2. (a) Find te slope of te tangent line to te parabola

More information

Data Structures and Programming Spring 2014, Midterm Exam.

Data Structures and Programming Spring 2014, Midterm Exam. Data Structures and Programming Spring 2014, Midterm Exam. 1. (10 pts) Order te following functions 2.2 n, log(n 10 ), 2 2012, 25n log(n), 1.1 n, 2n 5.5, 4 log(n), 2 10, n 1.02, 5n 5, 76n, 8n 5 + 5n 2

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

Fault Localization Using Tarantula

Fault Localization Using Tarantula Class 20 Fault localization (cont d) Test-data generation Exam review: Nov 3, after class to :30 Responsible for all material up troug Nov 3 (troug test-data generation) Send questions beforeand so all

More information

CSCE476/876 Spring Homework 5

CSCE476/876 Spring Homework 5 CSCE476/876 Spring 2016 Assigned on: Friday, Marc 11, 2016 Due: Monday, Marc 28, 2016 Homework 5 Programming assignment sould be submitted wit andin Te report can eiter be submitted wit andin as a PDF,

More information

( ) ( ) Mat 241 Homework Set 5 Due Professor David Schultz. x y. 9 4 The domain is the interior of the hyperbola.

( ) ( ) Mat 241 Homework Set 5 Due Professor David Schultz. x y. 9 4 The domain is the interior of the hyperbola. Mat 4 Homework Set 5 Due Professor David Scultz Directions: Sow all algebraic steps neatly and concisely using proper matematical symbolism. Wen graps and tecnology are to be implemented, do so appropriately.

More information

Tilings of rectangles with T-tetrominoes

Tilings of rectangles with T-tetrominoes Tilings of rectangles wit T-tetrominoes Micael Korn and Igor Pak Department of Matematics Massacusetts Institute of Tecnology Cambridge, MA, 2139 mikekorn@mit.edu, pak@mat.mit.edu August 26, 23 Abstract

More information

MAC-CPTM Situations Project

MAC-CPTM Situations Project raft o not use witout permission -P ituations Project ituation 20: rea of Plane Figures Prompt teacer in a geometry class introduces formulas for te areas of parallelograms, trapezoids, and romi. e removes

More information

Decision Problems. Observation: Many polynomial algorithms. Questions: Can we solve all problems in polynomial time? Answer: No, absolutely not.

Decision Problems. Observation: Many polynomial algorithms. Questions: Can we solve all problems in polynomial time? Answer: No, absolutely not. Decision Problems Observation: Many polynomial algorithms. Questions: Can we solve all problems in polynomial time? Answer: No, absolutely not. Definition: The class of problems that can be solved by polynomial-time

More information

CMSC 451: Lecture 22 Approximation Algorithms: Vertex Cover and TSP Tuesday, Dec 5, 2017

CMSC 451: Lecture 22 Approximation Algorithms: Vertex Cover and TSP Tuesday, Dec 5, 2017 CMSC 451: Lecture 22 Approximation Algorithms: Vertex Cover and TSP Tuesday, Dec 5, 2017 Reading: Section 9.2 of DPV. Section 11.3 of KT presents a different approximation algorithm for Vertex Cover. Coping

More information