In reference to a question brought up in this thread, I’m going to attempt to define NP-completeness.
First we need some notion of the running time of an algorithm. In order to do that, we need some measure of input size. This varies by problem (a concept I’m not going to define here), so we’ll just call it n.
The running time of a particular algorithm can be expressed exactly as some function of the input size. Let’s call it f(n). We’re very rarely interested in the specifics of f, so we make the following definition:
O(f(n)) is the set of all functions g(n) that are less than c*f(n) whenever n > n[sub]0[/sub], for some positive constants c and n[sub]0[/sub]. O(f(n)) is read “big-oh of f(n)”.
So instead of being very precise, we say that the running time of an algorithm is O(g(n)) for some suitable g(n). Equivalently, we say that g(n) is an asymptotic upper bound for the algorithm. There’s a similar concept of an asymptotic lower bound, but that’s not really important here.
Some algorithms are O(n[sup]k[/sup]) for some k. These algorithms are said to run in polynomial time.
In addition, sometimes we want to consider how long it takes to verify a solution. This means that, instead of calculating the solution ourselves, we are given a potential solution, and need to determine whether it is an actual solution.
The set of all problems that can be solved in polynomial time is called P. The set of all problems that can be verified in polynomial time is called NP. (If I told you what NP stands for, you’d just be confused. So don’t worry about it.) It should be fairly clear that every problem in P is also in NP.
Now here’s the thing: there are some problems that are as hard as anything in NP, and we can use algorithms that solve these problems to solve any problem in NP. More formally, an instance of any problem in NP can reduced (or transformed) into an instance of one of these problems, and then we can use a solver for that problem. Such a problem is called NP-hard (meaning that it’s at least as hard as anything in NP). When an NP-hard problem is in NP, we call it NP-complete.
One technical detail I omit is that all the problems we consider can be expressed as yes-no questions. This is sufficient to cover all possible problems.
Make sense? Questions?