Complexity
One way to rate algorithms is by the amount of time they take to run
relatively to the size of the input problem n.
One algorithm might on the order of n2 time, written as
O(n2).
This is an example of a polynomial time algorithm.
Another algorithm might take O(en) or O(n!)
time.
The complexity of a problem is commonly broken into three classes:
- P: an algorithm exists to solve the problem in polynomial time.
- NP: no algorithm has been discovered to solve the problem in polynomial
time, but a solution can be verified in polynomial time
- NP-complete: no algorithm can ever exist to solve the problem in
polynomial time.
Both P and NP classes of algorithms share the common characteristic
that given a proposed solution to a problem, the solution can be
verified in polynomial time.
The class of NP-complete problems are those that are in NP but not
in P.
To show that a problem is NP-complete, one would have to map the
the problem in polynomial time to some other NP-complete problem,
such as the CIRCUIT-SAT problem.
If a problem is NP-complete, then the only practical solution is
to use heuristics.
Since scheduling problems are generally NP-complete, heuristics
are commonly used.
---------------------
| |
| --- NP |
| | P | |
| --- |
| |
---------------------
Figure 5: Venn Diagram for the current model of the
relation of NP and P problems.
Updated 02/25/99.