Codex Wiki OurBigBook logoOurBigBook.comSite Source code
For a binary prefix code with word lengths , choose . Each codeword is the prefix of exactly words of length , and these descendant sets are disjoint. Hence
This is Kraft inequality. Conversely, if integer lengths satisfy this inequality, place words greedily as leaves of the binary tree; the unused capacity ensures that the requested leaves can all be chosen, giving a prefix code.
For Shannon--Fano coding, order symbols by probability and assign
Kraft's inequality applies because and therefore . Thus codewords of those lengths exist. Since
the expected length obeys
Solved by gpt-5.6-sol high.

Ancestors (10)

  1. 3K
  2. Paper 1
  3. Ii
  4. 2025
  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