← Student tools · Problem 19 · Lecture 9 · Round 2 (30 pts)

Single-tape vs Two-tape · {0ⁿ1ⁿ} race

Same problem. Different machine model. O(n²) vs O(n).

CLO-3R2·30 ptsL9
🔊 Listen

The same language {0n1n} that costs a single-tape TM Θ(n²) time (Problem 18) drops to O(n) on a two-tape TM. The strategy: copy the 0s to tape 2; then march tape 1 right through the 1s while tape 2 marches left through the copied 0s, both in sync. If both tapes hit their end-of-data markers at the same step, accept. If one runs out before the other, reject.

Sipser Theorem 7.8 · the robustness of P

Every k-tape Turing machine running in time t(n) can be simulated by a single-tape TM in time O(t(n)²). Polynomial composed with polynomial is polynomial, so P is invariant under tape count — the class doesn't change when you add or remove tapes.

The single-vs-two-tape gap on {0n1n} is the canonical example of this theorem in action: O(n) vs O(n²), exactly a quadratic blowup.

Two-tape pair-off in O(n): copy then sync-march Phase 1 · copy 0s to tape 2 (n steps) Tape 1: 0 0 0 1 1 1 Tape 2: 0 0 0 Phase 2 · march in sync (n steps) Tape 1 head → 1 at position of leftmost 1 Tape 2 head ← 0 at position of rightmost 0 If both hit blank simultaneously → equal counts → ACCEPT Tape 1 head moves right, tape 2 head moves left — every step is parallel work.
🔊 Listen
Two tape models racing on the same input Auto-plays

Single-tape · O(n²)

Steps: 0

Two-tape · O(n)

Steps: 0
🔊 Listen
🔊 Listen
🔊 Listen

Sipser: Theorem 7.8 (k-tape ↔ 1-tape simulation), Example 7.2. Lecture notes: Module 4 slide 4 has this exact race. Companion problem: P18 (single-tape Θ(n²) detail).