4.6.21 · HinglishTheory of Computation

Complexity — DTIME, DSPACE, complexity classes

2,221 words10 min readRead in English

4.6.21 · Coding › Theory of Computation


1. WHY we measure as a function of input size


2. DTIME and DSPACE — the atomic building blocks

YEH KYA HAIN: languages (decision problems) ke sets hain, akele problems nahi. kyun: linear speedup / tape-compression theorems ki wajah se, constant factors aur finite tape-alphabet tricks time/space ko kisi bhi constant se shrink kar sakte hain, isliye sirf asymptotic class matter karti hai.


3. Building named classes from DTIME / DSPACE


4. Deriving the inclusion hierarchy from first principles

Yeh woh part hai jo derive karna chahiye, memorize nahi. Hum har step prove karte hain.

Figure — Complexity — DTIME, DSPACE, complexity classes

5. The Hierarchy Theorems — why bigger budget = strictly more power


6. Worked examples


7. Common mistakes (Steel-manned)


8. Forecast-then-Verify

Recall Peeking se pehle forecast karo

Q: Kaun sa known strict hai: vs , ya vs ? Kyun?

A: known hai (Time Hierarchy: diagonalization ke zariye same kind ka zyada time). vs open hai kyunki diagonalization same resource ko different budgets par compare karta hai, lekin D-vs-N ek different kind ka change hai — hierarchy theorems apply nahi hote, aur "relativization barriers" dikhate hain ki simple diagonalization ise settle nahi kar sakta.


9. Flashcards

mein kya contain hota hai?
Woh saari languages jo kisi deterministic TM dwara steps (worst case) mein decide ki jaati hain.
ko DTIME ke terms mein define karo.
— polynomial deterministic time.
Time space kyun?
Head har step mein cell move karta hai, isliye steps mein woh cells visit karta hai.
DSPACE DTIME kyun?
Ek halting machine configuration repeat nahi kar sakti; sirf configurations hain.
Standard inclusion chain batao.
.
NP ka full form / matlab kya hai?
Nondeterministic Polynomial time = solutions poly time mein verifiable hain.
Savitch's theorem batao.
, isliye .
Kaun sa separation proved hai, ya ?
(Time Hierarchy Theorem). vs open hai.
"efficient" class kyun hai?
Polynomials composition ke under closed hain, isliye efficient steps ko chain karna efficient rehta hai.
Graph reachability kis complexity class ke liye complete hai?
ke liye (path ko ek node at a time guess karo space use karte hue).
Space classes ke liye condition kyun?
se neeche tum input mein pointer store nahi kar sakte; config counting ke liye zaroori hai.

Recall Feynman: ek 12-saal ke bachche ko explain karo

Socho tum puzzles solve kar rahe ho. Time hai kitne moves tum karte ho; space hai kitna bada scratchpad tumhe chahiye. Hum puzzles ko boxes mein sort karte hain ki kitne moves ya kitna paper chahiye. "Easy box" () un puzzles ko rakhta hai jahan puzzle bade hone par moves gently barhte hain — jaise , nahi. Ek neat trick: tum kabhi itne pieces of paper par scribble nahi kar sakte jitne moves tum karte ho (har move zyada se zyada ek nai jagah touch karta hai). Aur agar tum sirf ek chhota notebook use karo, tum bina ek exact notebook-state repeat kiye aur loop kiye hamesha nahi chal sakte — isliye chhota notebook secretly kitne time tak chal sakte ho yeh limit karta hai. Kuch boxes provably bade hain doosron se (zyada time sach mein zyada solve karne deta hai), lekin sabse famous question — kya answer guess karna tumhe usse dhundhne mein faster banata hai ( vs ) — abhi tak kisine solve nahi kiya.


Connections

  • Turing Machines — woh model jinke steps/cells hum count kar rahe hain.
  • NP-Completeness and Reductions ke andar sabse mushkil problems; frontier define karta hai.
  • Savitch's Theorem — nondeterministic space ko collapse karta hai.
  • Hierarchy Theorems — diagonalization se strict separations prove karta hai.
  • Decidability and the Halting Problem — complexity ke neeche computability layer.
  • Big-O Asymptotic Notation — kyun constant factors in definitions mein vanish ho jaate hain.
  • Space vs Time Tradeoffs vs ka engineering analogue.

Concept Map

measured by

defines

defines

swap D for N

swap D for N

union over n^k

union over n^k

union over 2^n^k

log n

union over n^k

log n

time bounds space

contributes to

ordered by

Resources: time and space

Cost as f of n

DTIME f

DSPACE f

Nondeterministic N variants

Class P polynomial time

Class NP

Class EXP

Class L log space

Class NL

Class PSPACE

Inclusion hierarchy