The binary Kraft inequality states that codeword lengths of a prefix code, or more generally a uniquely decodable code, satisfy
Conversely, positive integer lengths obeying this inequality can be realized by a binary prefix code.
The Shannon lengths are . Their Competitive optimality of the Shannon code says that for every binary uniquely decodable code of lengths and every positive integer ,
On this event, . Summing and applying the Kraft inequality proves
Relabel the symbols so and assign all finite binary strings in nondecreasing length order, beginning with the empty string. The th string has length
Since ,
Thus the optimal one-to-one binary code satisfies
For the uniform distribution, the code in part c has
because every summand is at most and at least one is strictly smaller. For , the explicit code , , has mean length .

Articles by others on the same topic (0)

There are currently no matching articles.