Docsity

Understanding NP-Completeness & Reductions: Decision Problems & Polynomial Time, Study notes of Computer Science

Toggle sidebar
bg1
12/3 CSE 202 - NP-complete
CSE 202 - Algorithms
NP Completeness
Approximations
CSE 202 - NP-complete2
Decision Problems
Instance: an input, an output, and a size.
Problem: a set of instances.
Decision Problem: Problem where each instance’s output is “T” or “F”.
“Given graph G and nodes x and y, what is the shortest
path from x to y?” is
not
a decision problem.
“Given G, x, y, and k, is there a path from x to y of length
£k?”
Usually, given an algorithm for a decision problem, one can
use it to solve the associated optimization problem.
–E.g., use binary search: “Is there a path of length £50?”,
“£25?“, “£37?“, ... .
(You know this
already.)
pf3

Partial preview of the text

Download Understanding NP-Completeness & Reductions: Decision Problems & Polynomial Time and more Study notes Computer Science in PDF only on Docsity!

12/3 CSE 202 - NP-complete

CSE 202 - Algorithms

NP Completeness

Approximations

Decision Problems

Instance: an input, an output, and a size. Problem: a set of instances. Decision Problem: Problem where each instance’s output is “T” or “F”.

“Given graph G and nodes x and y, what is the shortest

path from x to y?” isnot a decision problem.

“Given G, x, y, and k, is there a path from x to y of length

£ k?”

Usually, given an algorithm for a decision problem, one can

use it to solve the associated optimization problem.

  • E.g., use binary search: “Is there a path of length £ 50?”,

(You know this already.)

3 CSE 202 - NP-complete

Reductions

Given two decision problems A and B, we say that a

function f from A to B is a reduction of A to B if, for

every instance x in A, x is true if and only if f(x) is true.

We write A £ B , and say A is reducible to B.

A (^) B

x f(x)

{T,F}

f an instance of problem A

instance of B

Example of reductions

We’ve seen:

  • how to reduce a maximum matching problem on bipartite

graph to a max flow problem.

  • how to reduce a general maximum matching problem to

linear programming.

Except for 2 trivial problems, every computable function

is reducible to every other computable function.

  • Let b T be a true instance of B & b F a false instance.
  • Given instance x of problem A, f could figure out the answer, then return b T if x is true, b F otherwise.

Mathematicians use reductions to study uncomputable

functions (like the halting problem).

“Always True” & “Always False”