If, in an error detection and correction code, a message M: “You are good…
2009
If, in an error detection and correction code, a message M: “You are good students” is stored as M′: Youare areyou aregood goodare goodstudents studentsgood, what is the space required to store M′ in general? (Assume that n is the length of M.)
- A.
2n
- B.
3n
- C.
4n
- D.
less than 4n
Attempted by 1 students.
Show answer & explanation
Correct answer: D
Concept: In this error-detection-and-correction scheme, a message split into words W1, W2, ..., Wk is protected by storing, for every adjacent pair of words, both the forward concatenation and the reverse (swapped) concatenation. Every interior word belongs to two such adjacent pairs (once as the second word of one pair, once as the first word of the next); since each pair's concatenation is stored in both directions, an interior word's letters end up written into M′ four times over. The first word and the last word each belong to only one pair, so their letters are written into M′ only twice over.
Application: For M = "You are good students":
Split M into words: W1 = "You" (3 letters), W2 = "are" (3 letters), W3 = "good" (4 letters), W4 = "students" (8 letters), so n = 3 + 3 + 4 + 8 = 18 letters.
List the adjacent word pairs: (W1, W2), (W2, W3), (W3, W4) — three pairs for four words.
For each pair, store both the forward and the reversed concatenation, so each pair contributes its own length twice: (W1+W2) has 6 letters → 12 letters stored; (W2+W3) has 7 letters → 14 letters stored; (W3+W4) has 12 letters → 24 letters stored.
Add the three contributions: 12 + 14 + 24 = 50 letters, which is exactly the length of the given M′ = "Youare areyou aregood goodare goodstudents studentsgood".
Cross-check: Generalising the same counting to any k words: the total length of M′ = 2 × Σ(|Wi| + |Wi+1|) for i = 1 to k−1. Every interior word Wi (2 ≤ i ≤ k−1) is counted in two different pairs, but the first word W1 and the last word Wk are each counted in only one pair. So the total equals 4n − 2(|W1| + |Wk|) — always strictly less than 4n, since |W1| and |Wk| are always positive. Checking this item: 4×18 − 2×(3+8) = 72 − 22 = 50, matching the 50-letter M′ found above. So in general, the space required is always some amount less than 4n — it is never exactly 2n, 3n, or 4n as a fixed formula, which is why the correct answer is "less than 4n".