Padding Changes the Measured Input Length
Relate a language to a padded version without confusing value and length.
Assignment sources
Related exam and assignment appearances
These links mark a related idea or close version; only groups explicitly marked as exact repeats in the question map count as duplicates.
Problem
Let be decidable in time for a fixed . Over an alphabet containing a separator , define
Show that . Clearly state how malformed padded strings are handled.
Hint 1
If the full padded input has length , compare with .
Hint 2
Parsing and checking the exact number of zeros can be done by scanning the input while maintaining counters of bits.
Full solution
On input of length , require exactly one delimiter , obtaining a candidate prefix and suffix of zeros. Reject if the form is wrong. Compute and verify that the suffix length is exactly ; this can be done in time polynomial in by scanning and binary counting.
If well formed, simulate the decider for on . Its runtime is
because that many padding zeros occur in . Parsing plus simulation is polynomial in , so .
Checkpoint
Padding does not make the original computation intrinsically faster; it enlarges the length against which runtime is measured.
Provenance note
Original exercise based on the standard padding technique; no student submission is an authority.
Common mistakes
- Skipping a direction of correctness or an input-format edge case.
- Measuring resources against a numeric value rather than encoded input length.
- Treating an informal intuition as a proof of the stated bound.
Sources and verification
- Merged summary, pp. 124-130
- 2026 transcript 6
- Arora-Barak draft, padding discussion
- Catalog mapping:
data/exercises.json; statements and solutions are independently written; personal submissions are non-authoritative.