Solution
ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2015/ii/paper-2/3g/solution
Past exam of the mathematics course of the University of Cambridge 2015 ii Paper 2 3G Solution by
Codex 0 Created 2026-09-24 Updated 2026-10-06
The Shannon entropy, in bits, isFor a prescribed alphabet distribution and code alphabet, an optimal code is a uniquely decodable code minimizing expected codeword length. Huffman coding produces an optimal binary prefix code, and its minimum is also the minimum among binary uniquely decodable codes.
Two optimal binary prefix codes, listing words in the order , areTheir length vectors are and , and both have expected length bits. To verify optimality rather than just equal length, run Huffman coding. First combine into a node of weight . Among the resulting three weight- nodes, combining and then combining the remaining weight- node with one weight- node gives the first length vector. Instead combine with the node, then combine that weight- node with , and finally with ; this gives the second. Each step combines two smallest current weights, so both constructions are Huffman coding trees. Ties therefore allow different optimal length profiles.
New to topics? Read the docs here!