Information Theory and Coding Basics
A binary prefix code is being built, and the length-2 codewords 00 and 01 are already in use. Which of the following is the maximum number of length-3 codewords that can be added while keeping the prefix condition?
- A4
- B6
- C8
Show answer and explanation
Answer: A. 4
There are 2³ = 8 bit strings of length 3, but the four that begin with 00 or 01 (000, 001, 010 and 011) cannot be used. The remaining four, 100, 101, 110 and 111, are not in a prefix relation with either 00 or 01, so all of them can be added. The Kraft inequality gives the same result: 2/4 + n/8 ≤ 1, so n ≤ 4.
- A. Correct. The four length-3 bit strings that begin with 1 can be used.
- B. 6 is the 8 length-3 bit strings minus the number of codewords used, 2. But 00 and 01 are each the beginning of two length-3 bit strings, so four cannot be used.
- C. 8 is every length-3 bit string, including those that begin with 00 or 01.
Continue: 9 more Information Theory and Coding Basics questions