A topic in the Open Knowledge Graph — a free, open map of 15,495 topics and the order to learn them in.

Polynomial-Time Computation and the Class P

College Depth 91 in the knowledge graph ☐ I know this ☆ Set as goal
12topics build on this
494prerequisites beneath it
See this on the map →
Time Complexity and the Class PTuring Machines+1 more→→Boolean Satisfiability and Standard NP-Complete ProblemsNondeterministic Polynomial Time and NP+1 more
polynomial-time complexity-classes tractability

Core Idea

P is the class of languages decidable by a deterministic Turing machine in polynomial time. P represents 'efficiently solvable' problems in complexity theory. Whether P = NP—the most famous open problem in computer science—asks whether fast verification (NP) is equivalent to fast solving (P), with profound implications for cryptography and optimization.

Explainer

You already know from your Turing machine background that every decidable problem has an algorithm — but that says nothing about how *fast* the algorithm runs. A Turing machine might halt after 2n steps or after 2n steps. Polynomial time is the dividing line between "fast enough to be practically useful" and "too slow to scale." An algorithm runs in polynomial time if its worst-case step count is bounded by some polynomial in the input length: n, n², n³, and so on. The class P collects all languages (equivalently, all decision problems) for which a polynomial-time deterministic Turing machine exists.

Why polynomial specifically? The choice is somewhat pragmatic but defensible: polynomial-time algorithms compose (a polynomial of a polynomial is a polynomial), they scale to large inputs unlike exponential algorithms, and the class P is robust — it doesn't change if you switch between reasonable machine models. The textbook examples you should internalize: sorting a list of n numbers is O(n log n) — in P. Finding a shortest path in a graph is O(E log V) — in P. Multiplying two n-digit numbers is in P. These feel like "problems with known efficient solutions," which is exactly the intuition P captures.

The class NP (nondeterministic polynomial time) contains problems where a *proposed solution* can be verified in polynomial time, even if finding the solution might require searching. The canonical example: given a Boolean formula with n variables, verifying that a particular assignment satisfies it takes linear time — just plug in the values. But finding such an assignment seems to require trying exponentially many possibilities. This asymmetry — easy to check, potentially hard to find — motivates the P vs. NP question.

P ⊆ NP trivially: if you can *solve* a problem in polynomial time, you can certainly *verify* a solution in polynomial time (just re-solve it). The open question is whether NP ⊆ P — whether every problem whose solutions are easy to verify also has an efficient algorithm to *find* solutions. Most complexity theorists believe P ≠ NP, because if P = NP, every cryptographic system whose security rests on computational hardness (RSA, elliptic curves, most of modern security) would collapse. But no proof exists either way, and the question remains the deepest unsolved problem in theoretical computer science.

Your Big-O background makes the technical definition natural: a Turing machine runs in time O(nk) for some constant k. The key shift from algorithm analysis to complexity theory is that here, you're classifying *problems* rather than specific algorithms — a problem is in P if *any* polynomial-time algorithm exists, not necessarily a particular one. This reframing from "how fast is this algorithm?" to "what is the intrinsic computational difficulty of this problem?" is the core conceptual move of complexity theory.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Combining Small Groups Within 5 → Number Bonds Within 5 → Number Bonds to 10 → Tens and Ones Place Value → Reading and Writing Three-Digit Numbers → Comparing Three-Digit Numbers → Comparing and Ordering Three-Digit Quantities → Comparing and Ordering Whole Numbers → Comparing Numbers 1 to 20 → Ordering Numbers to 20 → Number Line 0 to 20 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Opposites and Additive Inverses → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Introduction to Propositional Logic → Introduction to Predicate Logic (First-Order Logic) → First-Order Logic Syntax → ZFC Axioms Overview → Axiom Schema of Separation → Axiom Schema of Replacement → Von Neumann Ordinals → Hereditarily Finite Sets → Recursive Definitions on Finite Sets → Natural Numbers in Set Theory: Iterative Construction → Formal Arithmetic and Expressibility → Turing Machines → Time Complexity and the Class P → Polynomial-Time Computation and the Class P

Longest path: 92 steps · 494 total prerequisite topics

Prerequisites (3)

Leads To (3)