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?

  1. ACABD
  2. BCBDA
  3. 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.
Practice this topic Back to topic

Books on Information Theory and Coding Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Information Theory and Coding Basics questions

  1. A binary prefix code is to be built by assigning codewords of the following lengths (numbers of bits) to the four symbols A to D. Which of the following sets of code lengths makes this possible?
  2. 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?
  3. A source emits the symbols A, B, C and D independently with probabilities 0.4, 0.3, 0.2 and 0.1, and it is encoded with a Huffman code. Which of the following is the average code length per symbol?
  4. A source emits the symbols A to E independently with probabilities 0.3, 0.25, 0.2, 0.15 and 0.1, and it is encoded with a Huffman code. The codewords may change depending on which of two equal probabilities is chosen first, but the average code length does not. Which of the following is the average code length per symbol?
  5. A source emits the symbols A, B and C independently with probabilities 0.6, 0.3 and 0.1, and its entropy is about 1.30 bits. Which of the following is closest to the efficiency (entropy ÷ average code length) when this source is encoded with a Huffman code?