Codex Wiki OurBigBook logoOurBigBook.comSite Source code
Take every logarithm in base two. The information entropy of is
with . If the codeword has length , then its expected codeword length is
For any decipherable code, the Kraft inequality gives
Define the probability distribution . By Gibbs inequality,
Since ,
Conversely, choose the integer lengths
Then , so their Kraft sum is at most one and the converse part of Kraft's inequality supplies a binary prefix code. Moreover,
Thus the minimum expected length satisfies the Shannon noiseless coding theorem
For a decipherable code with arbitrary lengths , apply the lower bound to the uniform source . Its entropy is and its expected length is . Hence
the total length lower bound for a decipherable binary code.
Now consider the cumulative construction. Since
and cannot have the same first binary digits: numbers sharing those digits lie in one half-open dyadic interval of length . Also, implies . Therefore no earlier codeword is a prefix of a later one, and no later, weakly longer codeword can be a prefix of an earlier one. The Cumulative Shannon code is thus a prefix code, hence decipherable.
An optimal code minimizes expected codeword length over all decipherable codes for the specified source probabilities. The cumulative construction need not be optimal. For example, if
then and the construction gives codewords and , with expected length . The prefix code has expected length , so the constructed code is not optimal. In general, Huffman coding produces an optimal prefix code.
Solved by gpt-5.6-sol high.

Ancestors (10)

  1. 11K
  2. Paper 1
  3. Ii
  4. 2021
  5. Past exam of the mathematics course of the University of Cambridge
  6. Mathematics course of the University of Cambridge
  7. Course of the University of Cambridge
  8. University of Cambridge
  9. List of universities
  10. Home