Not a \'pure\' programming question, but since it is deeply involved in programming theory, I thought it best to ask here.
Regarding the P NP problem, this excerpt from
Suppose you had tremendous parallelism -- however much you wanted. You could then simultaneously generate all possible solutions, check which of these were correct, and output a correct solution. In the presence of infinite parallelism, this is a method of generating a solution. The set of problems in NP are those for which this procedure would work quickly, because the only interesting computational step it is performing is checking whether solutions are correct, and this can be done efficiently for problems in NP. Note that for some other problems, even this parallelism would not allow us to find solutions quickly, since it requires that checking solutions is easy.
But we don't have infinite parallelism. Can we somehow simulate it, with only a polynomial amount of overhead? If so, we could imagine running the above procedure, and efficiently finding solutions for every problem for which verification was easy. This is the P vs. NP question.
Intuitively, it seems clear that the answer is "no" (i.e. P != NP). How could we possibly simulate infinite parallelism? This is what almost every expert believes. But it is a mystery how to prove it, and one that is worth $1,000,000 in prize money.
This problem has been solved today!
(Possibly.)
P
is the class of all languages that can be computed in polynomial time by a deterministic Turing machine. A modern computer is very much like a deterministic Turing machine, except that a Turing machine essentially has infinite memory. This distinction is generally ignored for practical purposes.
NP
is the class of all languages that can be computed in polynomial time by a non-deterministic Turning machine. A nondeterministic Turing machine does not correspond to any real-world device.
It is a basic fact of computational complexity that NP
is equivalent to the class of languages whose verification problems are in P
. In fact, NP
is sometimes defined as this class; the two definitions are interchangeable, and the verification definition has the benefit of direct relevance to the deterministic-Turing-machine-like computers in the real world.
So NP
is the class of problems that are verifiable in poly-time on a "real" machine and solvable in poly-time on a very similar theoretical machine. Thus, the questions of solvability and verifiability are linked.
Now, most computer scientists believe that P
and NP
are not equivalent; that is, that there exist languages computable in poly-time by a nondeterministic Turing machine but not by a deterministic Turing machine, or equivalently that are not solvable in poly-time by a deterministic Turing machine but whose solutions can be verified in poly-time by a deterministic Turing machine.
Essentially, in the set of NP, or Nondeterministic Polynomial time, problems, the answer can be verified in polynomial time. The question is whether all such problems can be determined in polynomial time.
If P=NP is true, and such algorithms are discovered many problems that are hard to solve but easy to verify the solution, such as proofs, become as easy to solve as to verify.
There isn't a direct relation here though. There may be an intuitive feel that verifying an answer is easier than generating an answer as part of any generation would be to ensure the answer is correct. Thus, one could take a brute force approach to try different solutions but this tends to lead to exponential complexities that are beyond P, or so that is what I recall from Complexity class years ago.
It may or may not be related.
People care about NP problems because we want to solve them quickly and all the time, but so far we have not found a way to solve them quickly. We want to know if there a quick way to solve them or if we should give up trying.