Information Theory and Coding Basics
A prefix code assigns the codewords A = 0, B = 10, C = 110 and D = 111 to the symbols A, B, C and D. Which of the following is the result of decoding the bit string 110100111 from the start?
- ACABD
- BCBDA
- CCBAD
Show answer and explanation
Answer: C. CBAD
Read from the start and cut as soon as a codeword matches. 110 gives C, the following 10 gives B, 0 gives A and the remaining 111 gives D, so the result is CBAD. Because it is a prefix code, the string can be cut in only one way like this and can be decoded without any separator symbols.
- A. Encoding CABD gives 110, 0, 10, 111, that is, 110010111, which differs from the given bit string.
- B. Encoding CBDA gives 110, 10, 111, 0, that is, 110101110, which differs from the given bit string.
- C. Correct. It cuts into 110, 10, 0, 111.
Continue: 9 more Information Theory and Coding Basics questions