NP-Completeness
- We want to talk about how "bad" an algorithm can become
- All of the algoithms we have studied so far are polynomial time algorithms
- O(nk) where k is an integer that does not depend on the input.
- k above is constant
- These problems are considered tractable
- Problems for which no polynomial time algorithm exists are considered
to be intractable
- The set of all problems that can be solved with a polynomial time algorithm is called the set P
- A decision problem is a problem where yes/no answer is appropriate
- All problems can be mapped (or turned into) decision problems.
- Consider an electronic cirucit.
- It has n boolean inputs, and one boolean output.
- Find a set of inputs which will produce a True for an output?
- One way to do this is try all possible permutations of the input.
- This is O(n!) if there are n inputs.
- This is not in class P.
- This is known as Circuit-Satisfiability.
- A verification algorithm is an algorithm that verifies an answer is correct given the answer and a key.
- For example, given a circit and a set of inputs, we can
determine if the circuit evaluates to true.
- We can even do this in polynomial time.
- Just try the input on the circuit.
- In the above example, the input to the circuit is a certificate
- If we can verify an answer, given a certificate, in polynomial time
the algorithm belongs to a class of problems called NP
- So P is the set of algorithms that can be performed in polynomial time.
- NP is the set of algorithms who's output can be verified in polynominal time.
- It seems that these are two distinct sets of algorithms.
- It is not known if P=NP, this is a major open question in CS
- But there are some big prizes if you can show this.