NP-complete problems
Not every problem can be solved in polynomial time,
that is, in time O(nk),
where n is the size of the input and
k is a constant independent of the input.
A decision problem is a question, the correct
answer to which is either Yes or No.
Decision problems can be categorized as being in one
of three categories:
- P --
there is a polynomial P such that
every instance I of the problem can be solved in
time bounded by P(size of I)
Example: Is array X in sorted order?
- not P --
there does not exist any polynomial P such that
every instance I of the problem can be solved in
time bounded by P(size of I)
Example: Will program X ever stop?
- unknown --
it is not known whether there exists a polynomial P such that
every instance I of the problem can be solved in
time bounded by P(size of I)
The "unknown" category can be split into two parts:
- NP-complete -- a special class of problems, as seen below
Example: Can set X of integers be partitioned into two subsets
such that the sum of the integers in one subset is equal to
the sum of the integers in the other subset?
- clueless
Example: Can integer X be expressed as the product
of two integers that each are greater than 1?
The NP-complete problems have these characteristics:
- if any one NP-complete problem really is in P then all are in P
- if any one NP-complete problem really is in not-P then all are in not-P
- each NP-complete problem can be solved in polynomial time
if non-determinism is allowed (NP),
that is, if we can guess an answer then we can verify that
the answer is correct in polynomial time
(this property is shared by problems in P)
An optimization problem can usually be expressed as a
polynomial sequence of decision problems and so can be said
to be polynomially equivalent to the corresponding
decision problem.
Example:
Find the minimum cost spanning tree.
Is there a spanning tree with cost at most c?
The big question: Is P ≠ NP?