← Student tools · Problem 41 · Lecture 15 · Round 3 (40 pts)

Log-space machine · palindromes ∈ L

Two pointers into the input, that's all the memory needed.

CLO-3CLO-5R3·40 ptsL15
🔊 Listen

L (sometimes LOGSPACE) is the class of decision problems solvable by a deterministic TM using O(log n) work-tape space. By convention, the input tape is read-only and doesn't count toward the space bound — otherwise L would equal P trivially via length-n input storage.

Why log n is the right scale

log n bits is exactly enough to store an index into the input — a pointer to a tape cell. So L-algorithms are roughly "those that work with a constant number of pointers into the input plus a constant amount of additional state."

PALINDROME ∈ L

On input w of length n: maintain two pointers i = 0 and j = n − 1. While i < j: read w[i] and w[j], reject if they differ, else i++ and j--. Accept if loop completes.

Space used: two pointers (⌈log2 n⌉ bits each) plus O(1) auxiliary state. Total: O(log n).

Other classic L problems: REACHABILITY in undirected graphs (Reingold 2008, a deep result), parity, comparison of two unary numbers, recognising regular languages.

🔊 Listen
Watch the two pointers converge Auto-plays
i,j 0,0
Cells 0
Verdict
🔊 Listen
🔊 Listen
🔊 Listen

Sipser: §8.4 (definitions of L and NL), examples. Lecture notes: Module 7 slide 1. Companion problems: P42 (NL-PATH), P43 (PATH is NL-complete), P44 (inductive counting).