4.6.21 · D5Theory of Computation

Question bank — Complexity — DTIME, DSPACE, complexity classes

1,503 words7 min readBack to topic

Before the questions, one tiny glossary so no symbol is unearned:


True or false — justify

A configuration means (state, head position, tape contents). Keep that in mind — several answers count them.

.
True. In steps the head moves at most one cell per step, so it touches at most cells — you can never use more space than time (Step 1).
.
False (and believed strict the other way). Space is reusable, so can run for up to steps before repeating a configuration — polynomial space buys exponential time, not the reverse.
is a proven theorem.
False. Only is proven (a deterministic machine is a trivial nondeterministic one). Whether it is strict is the open problem.
is a proven theorem.
True. The time hierarchy theorem separates them by diagonalization — with exponential time you simulate every polynomial-time machine and flip its answer, producing a language no polynomial machine decides.
.
True. A logspace machine has only polynomially many configurations, so you build its configuration graph and search it in polynomial time.
.
True, by Savitch's Theorem: , and squaring a polynomial is still polynomial, so nondeterminism gives no extra space power at the polynomial level.
is settled.
False — it is open. Savitch only gives , which is bigger than , so it does not collapse them.
.
True, and in fact strict by the time hierarchy theorem since . More time budget genuinely decides more languages.
If then .
True. , and linear is the case, which sits inside the union.
Constant factors matter when classifying a language into .
False. The linear-speedup / tape-compression theorems let you shrink time and space by any constant, which is exactly why the definitions use .
Every language is in some .
False. Only decidable languages have a halting machine; undecidable ones (like the halting problem, see Decidability and the Halting Problem) sit outside every class.

Spot the error

"Space is reusable, so ."
Backwards. Reuse means you use few cells but possibly many steps; the correct bound is (for ) by counting non-repeating configurations.
"NP stands for Non-Polynomial."
No — NP = Nondeterministic Polynomial time. It contains all of , so it certainly contains polynomial-time problems; the name refers to the machine model, not to ruling out polynomial time.
"."
is a union over all constant , strictly larger than the single class (which is ).
"A halting machine can revisit a configuration to save time."
If a deterministic machine ever repeats a configuration it would loop forever and never halt — so a halting machine visits each configuration at most once, which is exactly what bounds its running time.
"Savitch's Theorem gives ."
Savitch is about space, not time: . No such cheap squaring is known for nondeterministic time — that would essentially settle vs .
" can't even store the input, so it's useless."
The counts work-tape cells; the read-only input tape is not charged. A logspace machine still reads all symbols — it just can't copy them into working memory, only keep -bit pointers/counters.
" measures the average case."
The makes it the worst case — the single hardest input of that length — not the average.

Why questions

Why is chosen as the line between "tractable" and "intractable" rather than, say, ?
Because polynomials are closed under composition — a polynomial of a polynomial is polynomial — so chaining efficient subroutines stays efficient. Fixed-degree classes lack this robustness.
Why does bounded space force bounded time, but not the reverse?
Bounded space means finitely many configurations, and a halting machine cannot repeat one, so time is capped. Bounded time already caps space (Step 1), but low space still allows exponentially long non-repeating runs.
Why is known while is not?
The hierarchy theorems separate classes of the same resource type (D-time vs D-time) via diagonalization. vs compares different models (D vs N) at the same budget, where the flip-your-own-answer trick doesn't directly apply.
Why do we measure cost as a function instead of a single number?
A single number ("40 ms") is meaningless without input size; covers inputs of every size at once and exposes the growth rate, which dominates as inputs scale.
Why does verifying SAT being easy while solving it seems hard capture the heart of vs ?
NP is exactly "problems whose solutions are cheap to check". Whether cheap checking implies cheap finding for every such problem is precisely .
Why does the configuration count give ?
A configuration is fully described by the state ( choices), the head position among the used cells, and the contents of those cells (each of symbols, so ).
Why does Savitch cost space and not more?
Reachability in steps splits at a midpoint into two half-length reachability problems, giving recursion depth ; each level stores one -bit configuration, so .

Edge cases

Where does the bound need the extra hypothesis ?
You need at least space just to write down a head position on an -cell input; below that the configuration-counting argument (which uses for the head-position factor) doesn't cleanly hold.
What happens to the class hierarchy if the input has length (empty string)?
The machine still has finitely many configurations and either accepts or rejects immediately; is a single fixed input, so it never affects asymptotic class membership, which is about behaviour as .
Is (constant time) meaningful for a Turing machine?
Barely — in steps the single-tape head can't even scan the whole input, so it decides only trivial languages depending on a bounded prefix. Real classification starts at , enough to read the input once.
Does contradict using only space?
No. Log space means poly-many configurations (), and searching that polynomial-size graph takes polynomial time — small space, larger (but still polynomial) time.
For the reachability problem in , what is stored when the graph has no path at all?
The machine still only ever holds the current node and a step counter ( bits each); after guesses without reaching it rejects. It never stores the path, so space stays logarithmic regardless of the answer.
If a "machine" never halts on some inputs, can its language be placed in a class?
Not via that machine — requires a machine that halts on all inputs. A non-halting machine has undefined worst-case time and cannot certify class membership.
Is the empty language in , , and ?
Yes — a machine that rejects everything uses space and time (just to halt), so sits in the smallest classes and therefore in all the larger ones by inclusion.

Recall Quick self-test

One-word resource that space classes bound but which stays reusable ::: space (cells can be overwritten) The proof technique behind every hierarchy theorem ::: diagonalization (simulate then flip) The theorem making nondeterministic space cheap to determinize ::: Savitch's ()