Computer ScienceAlgorithms & Data StructuresAdvanced

P vs NP Problem

Also known as:P versus NPCook's Problem

The P vs NP problem asks whether every problem whose solution can be verified in polynomial time (class NP) can also be solved in polynomial time (class P). It is one of the seven Millennium Prize Problems, carrying a $1,000,000 prize from the Clay Mathematics Institute, and is considered the most important open question in theoretical computer science. If P = NP were proven, it would imply that problems like RSA encryption, protein folding optimisation, and NP-complete combinatorial problems could all be solved efficiently, fundamentally transforming cryptography, artificial intelligence, and computational biology.

Key Complexity Classes in the P vs NP Landscape

ClassDefinitionVerificationSolutionExample Problems
PSolvable in polynomial timePolynomialPolynomialSorting, shortest path, primality testing
NPVerifiable in polynomial timePolynomialUnknown (exp. worst case)SAT, Hamiltonian path, factoring (maybe)
NP-CompleteHardest problems in NPPolynomialUnknownSAT, TSP, Graph Colouring
NP-HardAt least as hard as NP-completeNot necessarily polyUnknownHalting problem, TSP optimisation
co-NPComplement of NP problemsPolynomial (for "no")UnknownTAUTOLOGY, non-Hamiltonicity
PSPACESolvable in polynomial spaceAnyPoly spaceQBF, game strategies

Interactive Tools

Clay Mathematics Institute — P vs NP

Open Tool

Brilliant — P vs NP

Open Tool

Khan Academy — Algorithms and Complexity

Open Tool
Venn diagram illustrating P, NP, NP-complete, and NP-hard complexity classes assuming P ≠ NP

Wikimedia Commons, CC BY-SA

Related Terms

The complexity classes "P" and "NP" were formally defined in the late 1960s–early 1970s. "P" (Polynomial time) was described by Jack Edmonds and Alan Cobham around 1965. "NP" (Nondeterministic Polynomial time) emerged from Stephen Cook's 1971 paper. The explicit "P vs NP" formulation as an open problem is attributed to Cook's 1971 work and was popularised by Karp's 1972 paper.

complexity-theorymillennium-problemtheoretical-computer-sciencecryptographynp-complete