Comment on page
Complexity Classes (P, NP)
| Problem Type | Verifiable in P time | Solvable in P time | Increasing Difficulty
| P | Yes | Yes | |
| NP | Yes | Yes or No * | |
| NP-Complete | Yes | Unknown | |
| NP-Hard | Yes or No ** | Unknown *** | |
- * An NP problem that is also P is solvable in P time.
- ** An NP-Hard problem that is also NP-Complete is verifiable in P time.
- *** NP-Complete problems (all of which form a subset of NP-hard) might be. The rest of NP hard is not.
- Decision problem: A problem with a yes or no answer.
- Note that the following definitions and discussions are centered about the decision problem (or if a solution is verifiable), and do not mention if you can find the solution (or if the problem is solvable).
- P is a complexity class that represents the set of all decision problems that can be solved in polynomial time.
- That is, given an instance of the problem, the answer yes or no can be decided in polynomial time.
- NP is a complexity class that represents the set of all decision problems for which the instances where the answer is "yes" have proofs that can be verified in polynomial time.
- This means that if someone gives us an instance of the problem and a certificate (sometimes called a witness) to the answer being yes, we can check that it is correct in polynomial time.
- Note that NP is for Nondeterministic Polynomial time; not non-polynomial time.
- NP-Complete: NP-Complete is a complexity class which represents the set of all problems
Xin NP for which it is possible to reduce any other NP problem
Xin polynomial time.
- Intuitively this means that we can solve
Yquickly if we know how to solve
Yis reducible to
X, if there is a polynomial time algorithm
fto transform instances
x = f(y)of
Xin polynomial time, with the property that the answer to
yis yes, if and only if the answer to
- NP-Hard: Intuitively, these are the problems that are at least as hard as the NP-complete problems.
- Note that NP-hard problems do not have to be in NP, and they do not have to be decision problems.
- The precise definition here is that a problem X is NP-hard, if there is an NP-complete problem Y, such that Y is reducible to X in polynomial time.