Proof: difference in codeword length is less than 2 (Huffman coding of uniform distribution)

589 Views Asked by At

Assume an alphabet in which all letters have the same probability. These letters are coded using a binary Huffman code. Proof that the difference in codeword length is less than 2.

It seems intuitively right but I do not know how to prove this formally.

Exact question is:

A source has an alphabet of $K$ letters, all having the same probability. These are coded using a binary Huffman code. Assume that $K = x \,2^j$, with $j$ integer and $1\le x <2$. Prove that all codewords have lengths $j$ or $j + 1$. Hint: Prove, using the code tree, that the difference in codeword length is less than $2$.

1

There are 1 best solutions below

0
On

It's apparently a modified version of question 2.14 from "Principles of Digital Communications" (Chapter 2: Coding for Discrete Sources) by Robert Gallager.

Consider a source with M equiprobable symbols.

(a) Let k = ceil(log M). Show that, for a Huffman code, the only possible codeword lengths are k and k − 1.
(b)As a function of M, find how many codewords have length k = ceil(log M). What is the expected codeword length L in bits per source symbol?