Take , as required for the lower bound in this part. A binary Huffman code has a full binary tree: every merge has two children, and all codewords are leaves. More generally an optimal prefix code for positive-probability symbols cannot have an internal vertex with only one child, since suppressing that vertex shortens its descendant codewords and reduces the expected length.
Choose a leaf of maximum depth . Its sibling must also be a leaf, since an internal sibling would have a descendant deeper than . These two leaves give the deepest sibling property of an optimal prefix code, and there are only leaves altogether. Therefore
For the degenerate singleton alphabet, an empty codeword suffices and ; the stated lower bound consequently excludes .
If all leaves of a full binary tree have depth , all binary paths of length end in leaves. Thus it has exactly leaves and . Equivalently, equality in the Kraft inequality gives .
Conversely, when a complete depth- tree is a prefix code with mean length . For any prefix lengths , convexity gives
so . The complete tree is optimal. A Huffman code attains this optimum, and equality in the strictly convex first inequality forces all its lengths to equal . Hence, for ,
This also proves that ties in the Huffman construction do not change the conclusion.
Use the balancing fact proved by the exchange argument in part d: every leaf of an optimal tree has depth or . A full binary tree with this property has all possible vertices at level ; at least one of these is split into two deepest leaves. Thus
These inequalities characterize the maximum codeword length exactly:
In the suggested notation , , this is for and for . The distinction at a power of two is important.
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 is
All 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 , proving
The argument applies to every optimal binary prefix tree for the uniform source, independently of how Huffman ties are resolved.
A full binary tree has Kraft sum one. For example, place mass one at the root and divide each internal vertex's mass equally between its children; a leaf at depth receives , and the total mass on leaves remains one. Using part d gives the two equations
Multiplying the second equation by and subtracting the first gives the uniform-source Huffman length distribution
If , the first number is zero and every codeword has length . Otherwise both levels occur. The corresponding mean length is .
For the uniform 27-symbol model, . The uniform-source Huffman length distribution gives
Thus five symbols receive four-bit codewords and the other 22 receive five-bit codewords. To realize these lengths, start with all 32 binary words of length five and collapse any five disjoint sibling pairs into their four-bit parents. This leaves exactly five leaves at depth four and 22 at depth five. All source letters have the same probability, so which five letters receive the shorter codewords is arbitrary.
The expected codeword length is
The 27 symbols may represent 26 letters and a space, but this idealization keeps them equiprobable; it is not an empirical frequency model of English.

Articles by others on the same topic (0)

There are currently no matching articles.