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.
- The Traveling Salesman Problem (TSP), Given a complete weighted Graph G=(V,E)
find the minimal cost simple cycle that visits all nodes.
- The Traveling Salesman Decision Problem(TSP), Given a complete weighted Graph G=(V,E), is there a simple cycle of cost K that visits all nodes?
- One way to do this is to compute all possible cycles.
- This is O(|V|!)
- Definately not in class P
- A verification algorithm is an algorithm that verifies an answer is correct given the answer and a key.
- For example, given a graph, the answer (Yes) and a simple cycle, we can
check to see if the cost of the cycle is equal to K.
- In the above example, the simple cycle 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
- Again, we can check the sum of all the paths in the certificate in O(|V|), and we can check to see if all of the verticies are on the path in O(|V|),
therefore the TSP is in the class NP
- It is not know if P=NP
- But there are some big prizes if you can show this.