Three poly-time algorithms with explicit running times.
P = ⋃k TIME(nk) — the union over all k of "decidable in O(nk) time." Sipser's three flagship examples (§7.2) cover the three flavors of "polynomial":
Algorithm: BFS from s; mark every reachable vertex. Accept iff t is marked.
Time: O(V + E). Linear in the graph size — about as fast as polynomial gets.
Algorithm: Euclid's algorithm — repeatedly replace (a, b) with (b, a mod b) until b = 0; gcd is the final a.
Time: O(log min(a, b)) iterations. Polynomial in bit length, which is what matters.
Algorithm: convert G to CNF; run CYK dynamic programming.
Time: O(n³ · |G|). Cubic — slower than the others but still polynomial.
The shift is often a single quantifier or a "for all/exists every" change. PATH asks any s-t path — easy. HAMPATH asks a path visiting every vertex — combinatorially hard. ADFA simulates one machine — easy. SAT asks for an assignment that satisfies every clause — hard.
Sipser: §7.2 (the three classic examples), Theorem 7.14, 7.15, 7.16. Lecture notes: Module 4 slide 5. Companion problems: P12 (decidable trio), P17 (growth race), P48 (P vs EXPTIME).