- Complexity Theory is the branch of theoretical computer science studying the intrinsic difficulty of computational problems.
- Unlike Computability Theory (asks can this be solved at all?), Complexity Theory asks how efficiently can it be solved?
- It quantifies the minimum time and space required by any algorithm solving a problem, as a function of input size .
- It establishes lower bounds (no faster algorithm exists) and upper bounds (an algorithm exists).
- It classifies problems into complexity classes by resource requirements, and studies reductions to compare problem difficulty and identify the hardest problems in a class (completeness).
Core questions driving the field
- Can every problem whose solution is easily verified (NP) also be easily solved (P)?
- Are there problems that are inherently exponential, requiring time that grows astronomically with input size?
- How do randomness, quantum mechanics, or parallel computation change what is efficiently solvable?
- Can unconditional lower bounds be proven, or must the field rely on unproven conjectures?
Models of computation
- Deterministic Turing Machine (DTM) - standard model; single computation path per input; time = number of transitions, space = number of tape cells used.
- Nondeterministic Turing Machine (NTM) - multiple computation paths, accepts if at least one path accepts; defines NP (polynomial time on an NTM).
- Randomized Turing Machine - equipped with a random bit source; captures probabilistic algorithms (BPP, RP, ZPP).
- Quantum Turing Machine (QTM) / Quantum Circuit Model - uses qubits and unitary transformations; defines BQP (bounded-error quantum polynomial time).
- Boolean Circuits - acyclic networks of logic gates; measured by circuit size (gate count) and depth (longest path); used for circuit complexity and lower bounds.
Resource measures
- Time complexity - number of elementary operations executed.
- Space complexity - number of memory cells used.
- Alternations - number of quantifier switches in a logical definition (Polynomial Hierarchy).
- Communication - number of bits exchanged between parties (Communication Complexity).
- Circuit size and depth - number of gates or layers in a Boolean circuit.
Asymptotic Notation
- - Big-O (upper bound)
- Definition:
- Meaning: worst-case growth, not necessarily tight.
- Example: Bubble Sort is .
- - Big-Omega (lower bound)
- Definition:
- Meaning: best-case or inherent difficulty.
- Example: comparison sorting is .
- - Big-Theta (tight bound)
- Definition:
- Meaning: upper and lower bounds match.
- Example: Merge Sort is .
- - little-o (strict upper bound)
- Definition:
- Meaning: grows strictly slower than .
- Example: .
- - little-omega (strict lower bound)
- Definition:
- Meaning: grows strictly faster than .
- Example: .
Common complexity hierarchy (increasing order)
- Polynomial time: any for constant .
- Exponential time: for , or more broadly .
Space complexity examples
- In-place algorithms use extra space (Heap Sort, Insertion Sort).
- Logarithmic space: (binary search, some graph traversal).
- Linear space: (Merge Sort, BFS with visited array).
- Polynomial space: , defines PSPACE.
- Exponential space: , used in brute-force SAT solvers storing all assignments.
Complexity Classes - Core Taxonomy
- P - Polynomial Time
- Machine/resource: DTM in time.
- Solvable efficiently in deterministic polynomial time; considered “tractable.”
- Iconic problems: sorting, shortest path, MST, 2-SAT, matching, primality (AKS).
- NP - Nondeterministic Polynomial Time
- Machine/resource: NTM in time.
- Solutions can be verified in polynomial time by a DTM.
- Iconic problems: SAT, Hamiltonian Cycle, TSP (decision), Clique, Vertex Cover.
- NPC - NP-Complete
- Hardest problems in NP; all of NP reduces to them. If any NPC problem is in P, then P = NP.
- Iconic problems: 3-SAT, Clique, Vertex Cover, Set Cover, Knapsack (decision).
- NPH - NP-Hard
- At least as hard as any NP problem (may not itself be in NP); typically optimization versions.
- Iconic problems: TSP minimization, Integer Programming, the Halting Problem (if unconstrained).
- PSPACE - Polynomial Space
- Machine/resource: DTM using space.
- Solvable with polynomial memory (may take exponential time); contains NP.
- Iconic problems: QBF, generalized games.
- PSPACE-C - PSPACE-Complete
- Hardest problems in PSPACE.
- Iconic problems: QBF, Generalized Geography, Sokoban, planning with full information.
- EXPTIME - Exponential Time
- Machine/resource: DTM in time.
- Contains PSPACE.
- Iconic problems: generalized Chess/Go/Shogi on boards.
- EXPTIME-C - EXPTIME-Complete
- Hardest problems in EXPTIME.
- Iconic problems: generalized Chess (), regular expression equivalence (with exponentiation).
- NEXPTIME - Nondeterministic Exponential Time
- Machine/resource: NTM in time.
- Contains EXPTIME.
- Iconic problems: succinct 3-SAT, succinct Circuit SAT.
- BPP - Bounded-error Probabilistic Polynomial Time
- Randomized DTM with error .
- Efficient poly-time algorithms using randomness, two-sided error.
- Iconic problems: Miller-Rabin primality test, Polynomial Identity Testing.
- RP - Randomized Polynomial Time (one-sided error)
- If the answer is NO, always correct; if YES, correct with probability .
- Iconic problems: some primality tests, polynomial identity.
- ZPP - Zero-error Probabilistic Polynomial Time
- Randomized DTM (Las Vegas); always correct, expected polynomial time.
- Iconic problems: randomized QuickSort (expected), certain factoring algorithms.
- BQP - Bounded-error Quantum Polynomial Time
- Quantum circuit in poly-time, error .
- Iconic problems: Shor’s factoring algorithm, discrete logarithm, Grover’s search (quadratic speedup).
- QMA - Quantum Merlin-Arthur
- Quantum verification; quantum analogue of NP.
- Iconic problems: Local Hamiltonians, QSAT.
- PH - Polynomial Hierarchy
- Alternating TMs with alternations.
- Generalization of NP and co-NP with alternating quantifiers; contains , .
- Iconic problems: QBF with bounded quantifier alternations.
- #P - Counting Problems
- Counts the number of accepting paths of an NTM (not just existence).
- Iconic problems: sat, the Permanent.
- PP - Probabilistic Polynomial Time (unbounded error)
- Randomized TM with success probability ; very broad, contains NP.
- Iconic problems: Majority-SAT, approximate counting.
Inclusion Relationships Between Classes
- and are known (by diagonalization).
- is open, and widely believed false.
- is open.
- is believed but unproven (derandomization results exist under plausible assumptions).
- is believed, due to Shor’s algorithm (factoring is not known to be in P).
- is open.
- is known (since if ).
Reductions and Completeness
- Polynomial-Time Reduction (Karp Reduction) - if there exists a polynomial-time computable function such that . Maps instances of to instances of , preserving the answer; used to define NP-Completeness.
- Cook Reduction (Turing Reduction) - if can be solved in polynomial time using an oracle for . More general than Karp reduction; allows multiple oracle calls.
- Log-Space Reduction - if the reduction uses only space. Finer-grained; used for classes like NL.
Completeness definitions
- A problem is NP-Complete if (1) , and (2) every problem in NP reduces to via .
- A problem is NP-Hard if every problem in NP reduces to ( need not be in NP).
- Similar definitions apply to other classes: PSPACE-Complete, EXPTIME-Complete, etc.
Proving NP-Completeness, step by step
- Show the problem is in NP: a certificate can be verified in polynomial time.
- Choose a known NP-Complete problem (typically 3-SAT or SAT).
- Construct a polynomial-time reduction from to the target problem .
- Prove correctness: has a solution iff has a solution for the constructed instance - this establishes is NP-Hard.
- Since already, is NP-Complete.
Common reduction sources and targets
- SAT / 3-SAT → logic, constraints, circuit problems → targets: Circuit SAT, NAE-SAT, Max-SAT, graph coloring, scheduling.
- Clique → graph existence problems → targets: Independent Set, Vertex Cover, Dominating Set.
- Vertex Cover → covering problems in graphs → targets: Set Cover, Hitting Set, Dominating Set.
- Hamiltonian Cycle → path and tour problems → targets: TSP, Longest Path, Steiner Tree.
- Set Cover → set systems and covering → targets: Hitting Set, Dominating Set, Facility Location.
- Subset Sum / Partition → number and arithmetic problems → targets: Knapsack, Scheduling (3-Partition), Bin Packing.
- 3-Dimensional Matching → matching and packing with triple constraints → targets: Set Packing, Exact Cover, Partition into Triangles.
Recommended reduction paths
- Logic problems → use SAT or 3-SAT.
- Graph problems → use Clique, Vertex Cover, or Hamiltonian Cycle.
- Set problems → use Set Cover or Exact Cover.
- Number problems → use Partition or Subset Sum.
- Geometry problems → use Euclidean TSP or Geometric Set Cover.
- Scheduling problems → use 3-Partition or Job Shop Scheduling.
Tractable Problems - Class P
Sorting and searching
- Comparison Sort -
- Counting Sort -
- Radix Sort -
- Bucket Sort -
- Binary Search -
- Dictionary Lookup -
- Order Statistics (selection) -
- Range Search -
Graph algorithms
- Breadth-First Search (BFS), Depth-First Search (DFS), Topological Sort.
- Strongly Connected Components (Tarjan/Kosaraju), Bridge Finding / Articulation Points.
- Dijkstra’s Algorithm -
- Bellman-Ford -
- Floyd-Warshall -
- Maximum Flow (Dinic) - ; Push-Relabel Algorithm
- Minimum Spanning Tree (Kruskal/Prim)
- Bipartite Matching (Hopcroft-Karp), General Matching (Edmonds’ Blossom)
- Minimum Cost Flow
- Assignment Problem (Hungarian) -
String algorithms
- Knuth-Morris-Pratt (KMP) -
- Z-Algorithm -
- Rabin-Karp - expected
- Suffix Array -
- Suffix Automaton -
- Suffix Tree -
- Aho-Corasick -
- Trie Operations -
- Longest Common Substring -
Computational geometry
- Convex Hull (Graham Scan / Andrew’s Monotone Chain) -
- Closest Pair (Divide and Conquer) -
- Line Sweep Algorithms -
- Half-Plane Intersection -
- Point in Polygon (Ray Casting / Winding Number) -
Number theory and algebra
- GCD / Extended GCD -
- Modular Exponentiation -
- Miller-Rabin Primality -
- Pollard’s Rho -
- Chinese Remainder Theorem
- Sieve of Eratosthenes -
- Gaussian Elimination -
- Matrix Multiplication -
- Fast Fourier Transform -
- Number Theoretic Transform -
- Linear Programming (interior point) - polynomial
- Polynomial Multiplication (FFT)
Other tractable problems
- 2-SAT - linear time (implication graph + SCC)
- Transportation Problem - Network Simplex / Hungarian
- Union-Find (Disjoint Set) - almost with path compression + union by rank
- Lowest Common Ancestor (LCA) - with preprocessing (Euler tour + RMQ)
- Heavy-Light Decomposition - per query
- Segment Tree / Fenwick Tree - per operation
- Range Minimum Query (RMQ) - with sparse table or Cartesian tree
NP Problems - Verifiable in Polynomial Time
- A problem is in NP if a proposed solution (certificate) can be verified in polynomial time by a DTM.
- NP includes all problems in P and all NP-Complete problems.
Notable NP problems (decision versions), by domain
- Logic & satisfiability: SAT, 3-SAT, 2-SAT, 1-in-3 SAT, Exact 3-SAT, Circuit SAT, NAE-SAT
- Graph problems: Hamiltonian Cycle, Hamiltonian Path, Clique, Vertex Cover, Independent Set, Graph Coloring, Dominating Set
- Set & subset problems: Set Cover, Exact Cover, Hitting Set, Set Packing, Set Splitting, 3-Dimensional Matching, Maximum Coverage
- Number & arithmetic: Subset Sum, Partition, 3-Partition, Equal Sum Partition, 0-1 Integer Programming, Quadratic Programming, Linear Ordering
- Other: Knapsack (Decision), Bin Packing, Longest Path, Steiner Tree, Chromatic Number
NP-Complete Problems - The Hardest Problems in NP
- Every problem in NP reduces to each NP-Complete problem in polynomial time.
- No polynomial-time algorithm is known for any of them.
- If any NP-Complete problem were solved in polynomial time, then P = NP.
Logic and satisfiability
- SAT (Cook-Levin theorem: first problem proven NP-Complete).
- Variants, all NPC: 3-SAT, 1-in-3 SAT, Exact 3-SAT, NAE-SAT, Circuit SAT, Max-SAT (decision), Weighted Max-SAT, Boolean Formula Minimization.
Graph theory
- Clique & covers: Clique / Maximum Clique, Independent Set (maximum), Vertex Cover (minimum), Edge Dominating Set, Clique Cover / Partition.
- Domination & coloring: Dominating Set (minimum), Total Dominating Set, Connected Dominating Set, Graph Coloring (k-color), Chromatic Number (min), k-Colorability, Domatic Number, Perfect Code, Power Domination.
- Paths & cycles: Hamiltonian Cycle, Hamiltonian Path, Longest Path (length ), Steiner Tree (minimum), Feedback Vertex Set, Feedback Arc Set, Disjoint Paths (k-disjoint).
- Layout & cuts: Cutwidth, Bandwidth, Minimum Linear Arrangement, Minimum Bisection, Max Cut, Maximum Acyclic Subgraph.
- Subgraphs & structure: Subgraph Isomorphism, Induced Subgraph Isomorphism, Minimum Fill-In, Chordal Completion, Planarity Testing Variants, Minimum Equivalent Digraph, Graph Motif, Efficient Dominating Set, Rainbow Connection.
Set and subset problems
- Set Cover (minimum) - fewest sets covering all elements.
- Hitting Set (minimum) - dual of Set Cover.
- Exact Cover (by 3-sets) - disjoint sets exactly covering all elements.
- Set Packing - maximum pairwise-disjoint sets.
- Set Splitting - 2-color elements so no set is monochromatic.
- Maximum Coverage (decision form), Minimum Test Set, k-Set Packing.
Number and arithmetic problems
- Subset Sum - subset summing to a target.
- Partition - split into two equal-sum subsets.
- 3-Partition - split a multiset into equal-sum triples.
- Equal Sum Partition (variant).
- Knapsack (decision) - value with weight .
- 0-1 Integer Programming (decision), Quadratic Programming (nonconvex), Quadratic Assignment Problem, Linear Ordering Problem, Number Partitioning variants, Simultaneous Diophantine Approximation.
Scheduling
- Job Shop / Open Shop / Flow Shop Scheduling - makespan ? ( machines, jobs).
- Multiprocessor Scheduling - makespan ? (identical/uniform machines).
- Scheduling with Deadlines, Resource-Constrained Project Scheduling, Nurse Scheduling, Course/Exam Timetabling - feasibility questions.
- Makespan Minimization (preemption allowed?), Precedence-Constrained Scheduling, Batch / Parallel Machine Scheduling, Interval Scheduling with Conflicts, Sequencing with Setup Times.
Packing and covering
- Bin Packing (decision: fits into bins?), Bin Packing with Conflicts, Strip Packing, 2D/3D Packing, Cutting Stock, Multiple Knapsack, Quadratic Knapsack, Partition into Triangles, Rectangle/Circle/Shelf Packing.
Routing and location
- Routing: Vehicle Routing Problem (VRP), Capacitated VRP, Traveling Repairman Problem, Rural Postman Problem, Chinese Postman (mixed graph), Orienteering Problem, Prize-Collecting TSP, Bottleneck TSP.
- Location: Facility Location (Uncapacitated/Capacitated), p-Median, p-Center, k-Center, k-Median, Hub Location, Location-Routing Problem.
Geometric
- Euclidean TSP, Rectilinear TSP, Rectilinear Steiner Tree, Euclidean Steiner Tree, Geometric Set Cover, Maximum Independent Set in Geometric Graphs, Geometric Hitting Set / Dominating Set, Art Gallery Problem, Guard Placement, Visibility Graph Problems.
String and sequence
- Closest String, Closest Substring, Longest Common Subsequence (multiple sequences), Shortest Common Supersequence (multiple), Bounded Post Correspondence Problem, Multiple Sequence Alignment, Consensus String, DNA Mapping, Sequence Assembly variants, Grammar-Based Minimization.
Games and puzzles (generalized to boards)
- All NPC: Generalized Sudoku, Kakuro, Nonogram (Picross), Minesweeper Consistency/Solving, Slither Link, Hashiwokakero, Heyawake, Nurikabe, Masyu, Fillomino, Battleship, Numberlink, Shakashaka, Light Up (Akari), LITS, Tatamibari, Tentai Show, Corral/Bag Puzzle, Sliding Puzzles with Obstacles, Edge-Matching Puzzles, Instant Insanity, -Queens Completion, Generalized FreeCell, Peg Solitaire, Rubik’s Cube Optimal Solving, SameGame, Tetris (optimization), Clickomania, Lemmings variants.
Karp’s 21 NP-Complete problems (1972)
- SAT, 3-SAT, Clique, Vertex Cover, Independent Set, Hamiltonian Cycle, Hamiltonian Path, Traveling Salesman (Decision), Set Cover, Exact Cover, Hitting Set, Partition, Subset Sum, Knapsack (Decision), 3-Dimensional Matching, Dominating Set, Graph Coloring, Chromatic Number, Clique Cover, Feedback Vertex Set, Feedback Arc Set, Steiner Tree.
NP-Hard Problems - Optimization Versions and Beyond
- At least as hard as any problem in NP, but need not be in NP themselves.
- Most are optimization versions of NP-Complete decision problems.
- No polynomial-time algorithm is known for any of them.
Optimization versions
- Traveling Salesman Problem (minimum tour length), Maximum Clique, Maximum Independent Set, Minimum Vertex Cover, Chromatic Number (minimum colors), Minimum Dominating Set, Minimum Set Cover, Minimum Steiner Tree, Minimum Feedback Vertex Set, Maximum Cut, Minimum Cutwidth / Bandwidth / Linear Arrangement / Bisection.
Routing and logistics optimization
- Vehicle Routing Problem, Capacitated VRP, Traveling Repairman Problem, Rural Postman Problem, Chinese Postman (mixed), Orienteering Problem, Prize-Collecting TSP, Bottleneck TSP, Steiner Traveling Salesman, Minimum Latency Problem, Traveling Tournament Problem.
Scheduling optimization
- Job Shop / Open Shop / Flow Shop / Multiprocessor Scheduling - minimize makespan.
- Scheduling with Release Dates - minimize makespan.
- Weighted Completion Time - minimize .
- Precedence-Constrained / Batch / Parallel Machine Scheduling - minimize makespan.
- Berth Allocation - minimize service time.
- Airport Gate Assignment - minimize delays.
- Crew Scheduling - minimize crew cost.
Location and facility optimization
- Facility Location (Uncapacitated/Capacitated) - minimize opening + assignment costs.
- p-Median - minimize sum of distances to centers.
- p-Center - minimize maximum distance to centers.
- k-Center, k-Median - similar objectives.
- Hub Location - minimize routing through hubs.
Packing and cutting optimization
- Bin Packing (minimize bins), Strip Packing (minimize height), Cutting Stock (minimize waste), Knapsack (maximize value), Multiple Knapsack, Quadratic Knapsack, 2D/3D Packing, Shelf Packing.
Algebra and arithmetic optimization
- General Integer Programming, Mixed Integer Programming, Quadratic Assignment Problem, Sparse PCA, Tensor Rank, Matrix Completion, Minimum Rank Problem, Boolean Matrix Factorization, Simultaneous Diophantine Approximation.
Data mining and learning optimization
- Optimal Decision Tree - minimize tree size/depth.
- Bayesian Network Structure Learning - maximize score (BIC, AIC).
- Sparse Feature Selection - minimize error with penalty.
- Rule List Minimization - minimize rules while maintaining accuracy.
- Boolean Function Learning - minimize formula size.
- Sparse Regression with Subset Constraints - minimize residual with limited features.
- Clustering with Combinatorial Constraints - minimize within-cluster distances.
- Minimum Description Length Optimization.
Computational biology and chemistry optimization
- Protein Folding (many formulations), RNA Secondary Structure with Constraints, Genome Assembly (optimization variants), Haplotyping, Phylogeny Reconstruction, Maximum Parsimony, Molecular Docking, Hartree-Fock Global Optimization, Ising Model and Spin Glass Optimization.
VLSI and hardware optimization
- VLSI Layout, Circuit Layout, Wire Routing, Floorplanning, Physical Design Partitioning, Circuit Minimization, Boolean Formula Minimization, Register Allocation, Frequency Assignment.
Graph optimization
- Maximum Common Subgraph / Induced Subgraph, Minimum Clique Cover, Cluster Editing / Deletion, Correlation Clustering, Split Graph Completion, Threshold Graph Editing, Perfect Graph Recognition, Minimum Fill-In, Minimum Chain Decomposition, Maximum Weight Induced Forest, Minimum Cycle Cover, Group Steiner Tree, Directed Steiner Tree, Prize-Collecting Steiner Tree, Survivable Network Design.
Other NP-Hard optimization problems
- Quadratic Assignment (general), Minimum Linear Arrangement, Graph Embedding Variants, Minimum Equivalent Digraph, Disjoint Paths with optimization, k-Dominating Set Optimization, Rainbow Connection Optimization, Symbolic Regression, Optimal Control with Integer Constraints.
PSPACE-Complete and EXPTIME-Complete Problems
PSPACE-Complete
- Quantified Boolean Formula (QBF) / True QBF - the canonical PSPACE-Complete problem; generalizes SAT with and quantified variables.
- Generalized Geography, Generalized Hex, Generalized Reversi/Othello, Generalized Sokoban, Generalized Rush Hour.
- Constraint Logic; LTL and CTL Model Checking (satisfiability).
- Generalized Chess, Checkers, Go, Shogi ( boards) - PSPACE-Complete or EXPTIME-Complete depending on formulation.
- Infinite-Horizon Games, Alternating Turing Machine Acceptance, Planning with Complete Information.
EXPTIME-Complete
- Generalized Chess, Checkers, Go, Shogi on boards under optimal play (game-theoretic winning).
- Infinite-Horizon Games; Alternating Turing Machine Acceptance with exponential time bound.
- Regular Expression Equivalence (with exponentiation and complement).
- Presburger Arithmetic (with quantifiers) - EXPTIME-Complete, actually double-exponential in some formulations.
Undecidable Problems - No Algorithm Exists
- Not computable by any Turing Machine that always halts correctly; lie beyond the entire complexity-class hierarchy.
- Halting Problem - given a program and input, does it halt? The classic undecidable problem.
- Busy Beaver - for , the maximum steps (or 1s written) an -state Turing Machine can take before halting, while still eventually halting. Uncomputable.
- Post Correspondence Problem - can a set of dominoes (strings on top/bottom) be arranged, with repetition, so the concatenations match? Undecidable.
- Entscheidungsproblem - is a first-order logic formula valid? Undecidable (Church-Turing).
- Rice’s Theorem - any nontrivial property of the language recognized by a Turing Machine is undecidable; implies program equivalence is undecidable.
- First-Order Logic Validity - undecidable (Church’s theorem).
- Hilbert’s Tenth Problem - does a Diophantine equation with integer coefficients have integer solutions? Undecidable (Matijasevich’s theorem).
- Word Problem for Semigroups - are two words equivalent under a semigroup presentation? Undecidable.
- Mortality Problem / Matrix Mortality - does some product of a set of matrices equal the zero matrix? Undecidable for sufficiently large matrices.
- Tiling Problem - can the infinite plane be tiled with a given set of Wang tiles? Undecidable.
Best Known Exact Algorithms for NP-Hard Problems
- Traveling Salesman (Held-Karp DP) - time , space
- Maximum Clique (improved Branch & Bound) - time , space
- Independent Set (improved branching) - time , space
- Vertex Cover (FPT branching) - time , space
- Graph Coloring (exponential backtracking/DP) - time , space
- Hamiltonian Cycle (inclusion-exclusion/DP) - time , space
- Steiner Tree (Dreyfus-Wagner DP) - time , space
- Dominating Set (branch & reduce) - time , space
- Set Cover (DP/Branch & Bound) - time , space
- Knapsack 0/1 (DP pseudo-poly or meet-in-the-middle) - time or , space matching
- Bin Packing / Job Shop Scheduling / Quadratic Assignment (Branch-and-Bound/ILP) - exponential time and space
The P vs NP Question (Millennium Prize Problem)
- One of the seven Millennium Prize Problems, and the most famous open problem in computer science.
- Statement: is ? Can every problem whose solution is quickly verifiable also be quickly solved?
- If : every NP-Complete problem gets a polynomial-time algorithm - revolutionizing mathematics, cryptography, AI, and operations research. Factoring/discrete-log-based cryptography breaks; optimization becomes tractable; automated theorem proving becomes efficient.
- If : some problems are easy to verify but inherently hard to solve - the widely believed scenario. It confirms computational difficulty is real, and justifies the need for approximation algorithms and cryptographic hardness assumptions.
- Current status: open. Evidence for :
- No polynomial-time algorithm found for any NP-Complete problem despite decades of effort.
- Such an algorithm would collapse the Polynomial Hierarchy.
- Cryptographic assumptions rely on .
- Still, no proof exists either way.
Polynomial Hierarchy (PH)
- Generalizes NP and co-NP via alternating quantifiers over polynomial-time predicates.
- Levels: ; ; ; ; ; ; ; .
- Complete problems: QBF with bounded quantifier alternations. E.g. -complete asks if holds; -complete asks if holds.
- If collapses to a finite level (), the hierarchy is finite.
- If , collapses to . If , collapses to .
- Widely believed: is infinite (no collapse). .
Randomized Complexity Classes
- BPP - two-sided error in polynomial time; correct with probability ; error amplifiable by repetition. Randomized analogue of P.
- RP - one-sided error: NO answers always correct; YES answers correct with probability .
- co-RP - complement of RP: YES answers always correct; NO answers correct with probability .
- ZPP - always correct, expected polynomial time; equals ; Las Vegas algorithms live here.
- PP - success probability ; very broad, contains NP; the gap from can be exponentially small, so amplification is nontrivial.
- Known relationships: . Believed . . .
- Key randomized algorithms: Miller-Rabin primality test (BPP), Polynomial Identity Testing (co-RP), randomized QuickSort (ZPP expected), random sampling for approximate counting.
Quantum Complexity Classes
- BQP - quantum analogue of BPP; error in polynomial time. Contains factoring (Shor’s algorithm) and discrete logarithm. . Believed , but unproven. Not known how BQP relates to NP; believed not to contain NP-Complete problems. Contains BPP. Grover’s algorithm gives a quadratic speedup for unstructured search.
- QMA - quantum analogue of NP: a quantum poly-time verifier plus a quantum certificate; YES instances accept with high probability on some certificate, NO instances don’t on any certificate. Contains NP and BQP. Complete problem: Local Hamiltonian Problem (quantum analogue of SAT).
- NQP - quantum analogue of NP with unbounded error; contains NP; less studied than QMA.
- Known relationships: ; . SAT solvable in via Grover’s algorithm on a quantum computer - still exponential.
Circuit Complexity
- Studies the size and depth of Boolean circuits (DAGs of AND/OR/NOT gates) needed to compute functions; a non-uniform model (a different circuit per input size).
- Key measures: circuit size (gate count), circuit depth (longest input-to-output path).
- Uniformity: a circuit family is uniform if a TM can generate in polynomial time (or log-space) from ; connects circuit complexity to standard complexity classes. Non-uniform circuits can be more powerful.
Important circuit classes
- NC - polynomial-size, polylogarithmic-depth circuits (uniform version); highly parallelizable problems.
- AC⁰ - constant-depth, unbounded fan-in AND/OR gates plus NOT; very low complexity.
- AC⁰[m] - AC⁰ plus MOD gates (counting modulo ).
- TC⁰ - constant-depth circuits with threshold (MAJORITY) gates.
- P/poly - polynomial-size non-uniform circuits; contains P and BPP.
- NCⁱ - depth , polynomial size; .
- ACC⁰ - AC⁰ with MOD gates of arbitrary modulus.
Known separations and importance
- for some (parity is not in ). .
- , but whether is unknown (would imply circuit lower bounds).
- Circuit lower bounds are notoriously hard - it was recently shown , but whether remains open.
- Circuit complexity is central to proving : showing would imply (since ) - but general circuit lower bounds are extremely difficult.
Communication Complexity
- Measures the bits two (or more) parties, each holding part of the input, must exchange to jointly compute a function.
- Models: deterministic, randomized (with error), quantum communication.
- Lower bounds: gives lower bounds for distributed/parallel computing time and space. Example: the disjointness function requires bits.
- Key results: the rank of the communication matrix (rows = party 1 inputs, columns = party 2 inputs, entries = output) gives lower bounds; randomized communication complexity relates to the matrix’s approximate rank; quantum communication can be exponentially smaller than classical for some functions.
- Applications: circuit lower bounds, data streaming algorithms, distributed databases, VLSI design.
Descriptive Complexity
- Characterizes complexity classes via logical formalisms, connecting logic, databases, and complexity theory.
Logical characterizations
- P - first-order logic with least fixed points (FO + LFP) on ordered structures.
- NP - existential second-order logic (ESO).
- PSPACE - first-order logic with partial fixed points (FO + PFP), or transitive closure.
- PH - second-order logic with bounded alternations.
- NL - transitive closure logic (TC) or deterministic transitive closure logic (DTC).
Key theorems
- Fagin’s Theorem (1974) - ; NP problems are exactly those definable by existential second-order formulas.
- Immerman-Vardi Theorem - on ordered structures.
- Applications: database query languages, finite model theory, structural understanding of complexity classes.
Approximation Algorithms and Inapproximability
- Since most NP-Hard problems can’t be solved exactly in polynomial time, near-optimal polynomial-time algorithms are studied instead.
- Approximation ratio: for minimization, ratio means solution cost ; for maximization, cost .
- Hardness of approximation: shown via gap reductions from NP-Complete problems - many problems can’t be approximated within certain ratios unless .
Known results
- TSP (metric) - best ratio (Christofides); inapproximable within for any unless .
- TSP (general) - not approximable within any constant unless .
- Vertex Cover - best ratio ; inapproximable below under the Unique Games Conjecture.
- Set Cover - best ratio ; inapproximable below unless .
- Max Cut - best ratio (Goemans-Williamson); inapproximable above unless .
- Knapsack - has an FPTAS (any ); no inapproximability bound.
- Bin Packing - best ratio (asymptotic); inapproximable below unless .
- Maximum Clique - best ratio ; inapproximable within unless .
PTAS / FPTAS
- PTAS - gives a -approximation in time .
- FPTAS - gives a -approximation in time . Knapsack has an FPTAS; TSP does not unless .
- Unique Games Conjecture (Subhash Khot) - the Unique Games constraint satisfaction problem is NP-Hard. Implies tight inapproximability results for Vertex Cover, Max Cut, and others. Still open.
Parameterized Complexity
- Studies problems with extra parameters (often solution size or a structural measure), seeking algorithms exponential only in the parameter and polynomial in input size.
- Fixed-Parameter Tractability (FPT) - an algorithm with running time , the parameter. Example: Vertex Cover is FPT with time.
- W-hierarchy - classes believed not FPT. is the parameterized analogue of NP. Clique (parameterized by ) is -Complete; Dominating Set is -Complete.
- Downey-Fellows theorem - if a problem is -Hard, it is not FPT unless (analogous to ).
- Kernelization - polynomial-time preprocessing reducing an instance to size bounded by ; a problem has a kernel iff it is FPT (under reasonable assumptions). Vertex Cover has an -vertex kernel (or with advanced techniques).
- Applications: real-world instances of NP-Hard problems (SAT, Graph Coloring, TSP) often have small parameters, making FPT algorithms practical.
Resources
Books
- Garey, M.R. & Johnson, D.S. - Computers and Intractability: A Guide to the Theory of NP-Completeness
- Papadimitriou, C.H. - Computational Complexity
- Sipser, M. - Introduction to the Theory of Computation
- Arora, S. & Barak, B. - Computational Complexity: A Modern Approach
- Vazirani, V. - Approximation Algorithms
- Downey, R.G. & Fellows, M.R. - Parameterized Complexity
Online resources
- Complexity Zoo - https://complexityzoo.net/Complexity_Zoo
- Wikipedia: List of NP-complete problems, Karp’s 21 problems, NP-hardness
- Compendium of NP Optimization Problems (Crescenzi & Kann)
- The Open Problem Garden
GitHub repositories