Solution

ID: past-exam-of-the-communication-theory-course-of-the-university-of-oxford/2008/3/b/solution

The entropy is
To construct a Huffman code, work with integer weights . Merge the two twos to make four. Of the remaining weights , merge three with the original four to make seven, and merge the new four with five to make nine. Finally merge seven with nine. Resolving the tie in this way gives, for example,
This is a prefix code and Huffman's optimality theorem makes it optimal. Its expected length is
Different choices at a tied merge can give different optimal codewords with the same expected length.
Figure 1.
An optimal five-symbol Huffman tree
. Edge labels give the binary digits, leaf labels give the source symbols and their probabilities, and interior labels give total descendant probability. Details.

New to topics? Read the docs here!