Past exam of the mathematics course of the University of Cambridge 2007 iii Paper 31 1 d Solution Created 2026-10-03 Updated 2026-10-14
Suppose a leaf has depth . By part a there is a sibling pair of leaves at depth . These leaves are disjoint from the shallow leaf and its descendants, since a leaf has no descendants. Modify the prefix tree of a code by splitting the shallow leaf into two leaves at depth and replacing the deepest sibling pair by their parent as one leaf at depth . The number of leaves remains , so assign the equiprobable source letters bijectively to the new leaves.
The sum of depths for the three affected leaves changes from to . The change isAll other depths are unchanged. Since probabilities are equal, this strictly decreases the expected codeword length, contradicting the optimality of the Huffman code. This is the balancing exchange for a uniform optimal prefix code. There is therefore no leaf of depth at most , provingThe argument applies to every optimal binary prefix tree for the uniform source, independently of how Huffman ties are resolved.
Uniform-source Huffman length distribution 2026-10-14
For equiprobable symbols, the maximum codeword length of a binary Huffman code is . Exactly codewords have length and have length . The balancing exchange for a uniform optimal prefix code restricts the depths to these two levels; counting leaves and using equality in the Kraft inequality determine the numbers.
// Target: probability-and-statistics.bigb