rmykkänen

notes

NP-completeness

date

Given a problem, there may exist any number of upper and lower bounds for solving it. The lower bounds can involve deep mathematical cross-problem relationships.

Introduction

Given an unsorted list of integers, return the list of indices as if it were sorted.

A potential solution: We have an obvious upper bound on sorting. In O(nlogn)O(nlogn) time, we can sort the array, keep track of the indices and return them. But can we do faster? Is there some o(nlogn)o(nlogn) algorithm?

Suppose there exists an o(nlogn)o(nlogn) algorithm, O(n)O(n) perhaps. Since you can sort the array based on the indices in linear time, this implies an o(nlogn)+O(n)=o(nlogn)o(nlogn) + O(n) = o(nlogn) sorting algorithm, a contradiction. Hence, the complexity of this problem is Ω(nlogn)\Omega(nlogn). This way of solving problems is called reduction, and is very popular in complexity theory.

Background

A decision problem is a problem which can be phrased as a yes or no question.

Define PP to be the class of decision problems decidable in polynomial time. If A∈P,∃A \in P, \exists an algorithm on input xx, to correctly say yes if x∈Ax \in A and no otherwise, ∃\exists some k>0k > 0 such that this algorithm runs in O(nk)O(n^k) time.

Why?

Reason 1: The class PP captures an intuitive notion of what it means for an algorithm to be "efficient". If there exists a polynomial time algorithm for a problem, either the problem is trivial or we have a mathematical characterization of the problem. Most problems have terrible brute force time complexities.

Reason 2: PP is closed under operations which do not violate our intuition about efficiency. The sum, product, and composition of polynomials are all polynomials. If f,gf, g are polynomial time algorithms, they are "efficient". An algorithm involving running ff, then gg, should maintain this intuition with its polynomial f+gf + g runtime.

Reason 3: By the time hierarchy theorems, problems of Ω(n99)\Omega(n^{99}) do exist, though apparently useless.

Completeness

NP-complete problems are the hardest problems in NPNP.

Prove a problem is NP-complete by defining a polynomial time reduction for two problems A,BA, B such that A≤pBA \leq_{p} B1. AA is poly time reducible to BB if there exists ff which is computable in polynomial time such that x∈A  ⟺  f(x)∈Bx \in A \iff f(x) \in B.

In short, to prove a problem BB is NP-complete, show B∈NPB \in NP and BB is NP-hard, usually by virtue of AA being NP-complete and A≤pBA \leq_p B.

Footnotes

  1. Think of (A≤pBA \leq_{p} B) as BB being as hard or harder than AA. BB is an upper bound for AA; AA is a lower bound for BB. ↩