Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Structures and Algorithm Analysis Lecture 24

Similar presentations


Presentation on theme: "Data Structures and Algorithm Analysis Lecture 24"— Presentation transcript:

1 Data Structures and Algorithm Analysis Lecture 24
CSCI 256 Data Structures and Algorithm Analysis Lecture 24 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some by Iker Gondra

2 Basic terminology Recall we consider that the input to a computational problem will be encoded as a finite binary string. Denote the length of a string s by | s | Identify a decision problem X with the set of strings on which the answer is “yes”. An algorithm A for a decision problem receives an input string s and returns the answer “yes” or “no”. We say that A solves the decision problem if for all strings s we have A(s) = yes if and only if s ε X.

3 NP Def: Algorithm C(s, t) is a certifier for a decision problem X if for every string s, s  X iff there exists a string t such that C(s, t) = yes NP: A decision problem X is in NP if there exists a poly-time certifier C(s,t), which means C(s, t) is a poly-time algorithm and |t|  p(|s|) for some polynomial p(). Remark: NP stands for nondeterministic polynomial-time

4 NP-Complete NP-complete: A problem Y is NP=complete if Y is in NP and for every problem X in NP, X  p Y Theorem: Suppose Y is an NP-complete problem. Then Y is solvable in poly-time iff P = NP Pf:  If P = NP then Y can be solved in poly-time since Y is in NP Pf:  Suppose Y can be solved in poly-time Let X be any problem in NP. Since X  p Y, we can solve X in poly-time. This implies NP  P We already know P  NP. Thus P = NP

5 NP-Complete If there is any problem in NP that cannot be solved in poly time, then no NP complete problem could be solved in poly time Write as: If there exists X in NP which is not poly-time => For all Y in NP complete (Y is not poly-time) Prove contrapositive: i.e., prove Exists Y in NP complete which is poly-time => all X in NP X is poly-time Proof: Assume there is some NP complete problem Y that can be solved in poly time; let X be any problem in NP; since X  pY, we may conclude that X can be solved in poly time

6 Fundamental questions: How do we know such problems exist
Fundamental questions: How do we know such problems exist? Do there exist "natural" NP-complete problems? (meaning problems that we are interested in solving, not some artifically constructed problem)

7 Circuit Satisfiability
CIRCUIT-SAT: Given a combinational circuit built out of AND, OR, and NOT gates, is there a way to set the circuit inputs so that the output is 1?

8 Circuit Satisfiability
CIRCUIT-SAT: Given a combinational circuit built out of AND, OR, and NOT gates, is there a way to set the circuit inputs so that the output is 1? output yes: 1 ? ? ? hard-coded inputs inputs

9                     Find a satisfying assignment
x3 x4 x5 x1 x2

10 Circuit Satisfiability
Nobody knows how to solve this problem faster than just trying all possible 2n inputs to the circuit, but this requires exponential time But also, nobody has proven that this is the best we can do!

11 The "First" NP-Complete Problem
Theorem: CIRCUIT-SAT is NP-complete. [Cook 1971, Levin 1973]. Pf: (sketch) Need to take any NP problem X and show: X  p CIRCUIT-SAT First we remark: Any algorithm that takes a fixed number of bits n as input and produces a yes/no answer can be represented by a circuit of AND, OR and NOT gates which is satisfiable iff answer is yes Moreover, if algorithm takes poly-time, then circuit is of poly-size (we won’t go into the transformation from algorithm to circuit – but any algorithm implemented on physical computers can be reduced to their operations on the /\, V, and ¬ gates; need to fix the number of input bits as a circuit is structurally hardcoded)

12 The "First" NP-Complete Problem
Let X be a problem in NP. It has a poly-time certifier C(s, t). To determine whether s is in X, need to know if there exists a certificate t of length p(|s|) such that C(s, t) = yes View C(s, t) as an algorithm on n =(|s| + p(|s|) bits (input string s, certificate t) and convert it into a poly-size circuit K first |s| bits are hard-coded with s remaining p(|s|) bits represent bits of t Circuit K is satisfiable iff C(s, t) = yes

13 Establishing NP-Completeness
Remark: Once we establish first "natural" NP-complete problem, others fall like dominoes Recipe to establish NP-completeness of problem Y Step 1. Show that Y is in NP Step 2. Choose an NP-complete problem X Step 3. Prove that X  p Y Justification: If X is an NP-complete problem, and Y is a problem in NP with the property that X  P Y then Y is NP-complete Pf: Let W be any problem in NP. Then W  P X  P Y By transitivity, W  P Y Hence Y is NP-complete


Download ppt "Data Structures and Algorithm Analysis Lecture 24"

Similar presentations


Ads by Google