The codeword lengths are integers. For necessity, take and view codewords as nodes of the binary tree. A codeword of length has descendant words at depth . Prefix-freeness makes these descendant sets disjoint, soFor sufficiency, reorder the lengths nondecreasingly. Assign words successively. At depth , words extending previously assigned codewords numberThe asserted inequality, even after dropping the later nonnegative terms, givesThus at least one depth- word does not extend an earlier word. Choose it. Since lengths are nondecreasing, it cannot be a proper prefix of a shorter earlier word, and equal-length duplicates have been excluded. Induction constructs the required code. Therefore Kraft inequality is necessary and sufficient:
For the construction, take the Shannon lengths . Then , so Kraft's condition holds. Also for every . Averaging givesFor a nontrivial alphabet all , so these lengths are positive and the ordinary code convention applies. For a deterministic one-symbol source, the usual zero-bit convention uses when the number of source symbols is externally known. If strictly nonempty codewords and arbitrary unframed message lengths are required instead, that degenerate case has and cannot satisfy the printed strict upper bound. This convention issue does not affect sources with at least two symbols.
Articles by others on the same topic
There are currently no matching articles.