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

Time Complexity Classes: P and EXPTIME

Graduate Depth 92 in the knowledge graph ☐ I know this ☆ Set as goal
109topics build on this
492prerequisites beneath it
See this on the map →
Turing MachinesAsymptotic Notation: Big-O, Big-Omega, Big-Theta+2 more→→Complexity Class P: Polynomial TimeComputational-Statistical Tradeoffs+4 more
P EXPTIME complexity polynomial-time time-complexity

Core Idea

The class P consists of all decision problems solvable by a deterministic TM in polynomial time O(nᵏ) for some constant k. P captures problems that are 'efficiently solvable' and includes sorting, shortest paths, primality testing, and linear programming. EXPTIME contains problems solvable in exponential time 2^poly(n); it strictly contains P. Basing complexity on TM running time formalizes the intuitive notion of tractability. The polynomial-time model is robust across reasonable machine models — polynomial in one is polynomial in another.

How It's Best Learned

Classify known algorithms into P: sorting is O(n log n) ⊆ P, BFS/DFS is O(V+E) ⊆ P. Then encounter problems (chess, exponential-search problems) known to require exponential time. This calibrates the P boundary.

Common Misconceptions

Explainer

From your study of Turing machines and algorithm analysis, you know that some problems are computable and some are not. Time complexity classes refine the computable problems by asking: how much time does the fastest algorithm need? The class P (polynomial time) contains every decision problem — every yes-or-no question — that a deterministic Turing machine can solve in time O(nᵏ) for some fixed constant k, where n is the input size. Sorting an array, finding shortest paths in a graph, testing whether a number is prime, and solving linear programs are all in P.

The significance of P is not that polynomial algorithms are always fast in practice — O(n¹⁰⁰) is technically polynomial but useless. Rather, P captures a robust notion of tractability that is independent of the specific computational model. A problem solvable in polynomial time on a single-tape Turing machine is also polynomial on a multi-tape machine, a RAM machine, or any other reasonable deterministic model. The exponent and constants may change, but the polynomial boundary holds. This robustness is what makes P a meaningful theoretical class rather than an artifact of one particular machine definition.

EXPTIME contains problems solvable in time 2^p(n) for some polynomial p(n). Unlike the relationship between many complexity classes, we can prove that P ⊊ EXPTIME — P is strictly contained in EXPTIME. This is established by diagonalization and the time hierarchy theorem, which shows that giving a Turing machine substantially more time allows it to solve strictly more problems. Concrete EXPTIME-complete problems include determining the winner of generalized chess, checkers, or Go on an n×n board — games where the enormous branching factor and game length provably require exponential exploration.

Between P and EXPTIME lies the landscape where the most famous open questions in computer science reside. The class NP (which you will study next as nondeterministic polynomial time) sits between P and EXPTIME, and the P vs. NP question asks whether efficient verification of solutions implies efficient discovery of solutions. For now, the key conceptual takeaway is the hierarchy: some decidable problems are efficiently solvable (P), some require exponential time (EXPTIME-complete), and the time hierarchy theorem guarantees that more time genuinely means more computational power. Undecidable problems like the halting problem sit entirely outside this framework — they cannot be solved in any amount of time, no matter how generous.

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 → Addition Within 10 → Number Bonds to 10 → 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 → Comparing and Ordering Integers → 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 → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Boolean Algebra and Fundamental Laws → Logic Gates Fundamentals → Implementing Boolean Functions with Gates → Karnaugh Map Simplification → Combinational Circuit Design → Flip-Flops and Latches → Finite State Machines (FSMs) → Deterministic Finite Automata (DFA) → Nondeterministic Finite Automata (NFA) → Two-Way Finite Automata → NFA to DFA Conversion (Subset Construction) → DFA Properties and Minimization Algorithms → Regular Languages: Definition and Characterization → Context-Free Grammars (CFGs) → Pushdown Automata (PDA) → Equivalence of CFGs and Pushdown Automata → Closure Properties of Context-Free Languages → Limitations of Context-Free Languages → Pumping Lemma for Context-Free Languages → Turing Machines → Time Complexity Classes: P and EXPTIME

Longest path: 93 steps · 492 total prerequisite topics

Prerequisites (4)

Leads To (6)