Information Theory and Coding Basics

A binary source emits 0 with probability 0.8 and 1 with probability 0.2, independently. Symbols are taken two at a time, each of the four pairs 00, 01, 10 and 11 is treated as one symbol, and they are encoded with a Huffman code. Which of the following is the average code length per original symbol?

  1. AAbout 0.72 bits
  2. B0.78 bits
  3. C1 bit
Show answer and explanation

Answer: B. 0.78 bits

The four pairs have probabilities 0.64 for 00, 0.16 for 01 and 10, and 0.04 for 11. 0.04 and 0.16 are merged into 0.2, 0.2 and 0.16 into 0.36, and finally that with 0.64, so the code lengths are 1, 2, 3 and 3 bits and the average per pair is 0.64 × 1 + 0.16 × 2 + 0.16 × 3 + 0.04 × 3 = 1.56 bits. Per original symbol this is 1.56 ÷ 2 = 0.78 bits. Coding one symbol at a time can only give 0 and 1 one bit each, but coding symbols together brings the length closer to the entropy of about 0.72 bits.

  • A. About 0.72 bits is the entropy of this source, the lower bound of the average code length. Grouping only two symbols does not yet reach it.
  • B. Correct. 1.56 ÷ 2 = 0.78 bits.
  • C. 1 bit is the value when the symbols are coded one at a time. Coding binary symbols one at a time needs one bit for each.
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. Which of the following correctly describes the relationship between lossless compression and the entropy of a source?
  2. The 40-character string AAAAAAAAAAAABBBBCCCCCCCCCCCCCCCCCCCCDDDD (12 As, 4 Bs, 20 Cs and 4 Ds) is compressed with run-length encoding, which represents each run of the same character as a pair of "character (1 byte) and count (1 byte)". The original string uses 1 byte per character. Defining the compression ratio as "size after compression ÷ size before compression", which of the following is the compression ratio?
  3. Which of the following data is most likely to be made smallest by run-length encoding?
  4. Which of the following correctly describes the idea of the LZ77 method used in ZIP, gzip and similar tools?
  5. Data compressed with the LZ77 method are to be restored. The data consist of "character A", "character B" and "(distance 2, length 5)", in that order. (distance d, length L) means repeating L times, one character at a time, "copy the character d characters back from the end of the restored string to its end". Which of the following is the restored string?