WHAT they are: sets of languages (decision problems), not single problems.
WHY O(⋅): by the linear speedup / tape-compression theorems, constant factors and
finite tape-alphabet tricks can shrink time/space by any constant, so only the asymptotic class matters.
Q: Which is known strict: P vs NP, or P vs EXP? Why?
A:P⊊EXP is known (Time Hierarchy: more time of the same kind
via diagonalization). P vs NP is open because diagonalization compares
the same resource at different budgets, but D-vs-N is a different kind of change — hierarchy
theorems don't apply, and "relativization barriers" show simple diagonalization can't settle it.
All languages decided by some deterministic TM in O(f(n)) steps (worst case).
Define P in terms of DTIME.
P=⋃kDTIME(nk) — polynomial deterministic time.
Why time f⇒ space ≤f?
The head moves ≤1 cell per step, so in f steps it visits ≤f+1 cells.
Why does DSPACE(f)⊆ DTIME(2O(f))?
A halting machine can't repeat a configuration; there are only 2O(f) configurations.
State the standard inclusion chain.
L⊆NL⊆P⊆NP⊆PSPACE⊆EXP.
What does NP stand for / mean?
Nondeterministic Polynomial time = solutions verifiable in poly time.
State Savitch's theorem.
NSPACE(f)⊆DSPACE(f2), so NPSPACE=PSPACE.
Which separation is proved, P=EXP or P=NP?
P=EXP (Time Hierarchy Theorem). P vs NP is open.
Why is P the "efficient" class?
Polynomials are closed under composition, so chaining efficient steps stays efficient.
Which complexity class is graph reachability complete for?
NL (guess the path one node at a time using O(logn) space).
Why the f≥logn condition for space classes?
Below logn you can't store a pointer into the input; needed for config counting.
Recall Feynman: explain to a 12-year-old
Imagine solving puzzles. Time is how many moves you make; space is how big a scratchpad
you need. We sort puzzles into boxes by how many moves or how much paper they need. The "easy
box" (P) holds puzzles where moves grow gently as the puzzle gets bigger — like
n2, not 2n. One neat trick: you can never scribble on more pieces of paper than the number
of moves you make (each move touches at most one new spot). And if you only use a tiny notebook,
you can't go on forever without repeating an exact notebook-state and looping — so a small
notebook secretly limits how long you can run. Some boxes are provably bigger than others
(more time really lets you solve more), but the most famous question — does guessing the answer
help you find it faster (P vs NP) — nobody has solved yet.
Dekho, complexity theory ka core idea simple hai: hum poochte hain "problem solve ho sakti hai?"
(woh computability hai) aur uske baad "kya woh reasonable time aur memory me solve hogi?" — yahi
complexity hai. Do main resources hain — time (kitne steps lagte hain) aur space (kitni tape
ya memory chahiye). Inhe hum hamesha input size n ke function ke roop me likhte hain, kyunki bada
input matlab zyada kaam. DTIME(f) matlab "saari problems jo deterministic TM O(f(n))
steps me decide kar le", aur DSPACE(f) space ke liye same baat.
In choti bricks se badi classes bante hain: P=⋃kDTIME(nk) — yani
polynomial time, jise "efficient" maana jaata hai (kyunki polynomial ke andar polynomial daalo toh
phir bhi polynomial rehta hai, robust hai). NP matlab guess-and-verify in polynomial time.
Ek bahut zaroori derivation: head ek step me ek hi cell hilta hai, isliye time f ka matlab space
≤f — yani P⊆PSPACE. Aur agar space kam hai toh configurations bhi
limited (2O(f)), aur halting machine koi configuration repeat nahi kar sakti, isliye time bhi
2O(f) tak hi — bas isi se poori chain ban jaati hai:
L⊆NL⊆P⊆NP⊆PSPACE⊆EXP.
Yeh matter kyun karta hai? Kyunki interview aur GATE dono me yahi geography puchi jaati hai. Yaad
rakho do galtiyan: (1) space time se chhota hota hai inclusion me, ulta nahi — reuse ke chakkar me
confuse mat hona; (2) P⊆NP toh pakka hai par strict hai ya nahi yeh
aaj tak koi nahi jaanta — yahi famous P vs NP million-dollar sawaal hai.
Lekin P=EXP proved