What are P, NP-Complete, and NP-Hard?

I ended up writing this for someone on StackOverflow; thought I’d preserve it here too. We start with the idea of a decision problem, a problem for which an algorithm can always answer “yes” or “no.” We also need the idea of two models of computer (Turing machine, really): deterministic and non-deterministic. A deterministic computer […]