A one-to-one source code is an injective function from source symbols to finite codewords. Unlike a prefix code, it need not permit instantaneous decoding of concatenated codewords.
Suppose one source message is transmitted with its endpoint supplied externally, and allow the empty word. List source symbols in decreasing order of probability, , and assign distinct binary words in increasing length order. Then the th word has length , minimizing expected codeword length among one-to-one source codes.[ref]
There are binary words of length at most . This proves the length formula. If a more probable symbol had a longer word than a less probable one, exchanging the two would decrease or preserve the expected value of the length, proving optimality.
For probabilities , use the empty word, 0 and 1. The average is bit, compared with bits for an optimal binary prefix code. The difference uses the supplied endpoint: the three-word assignment cannot decode an arbitrary concatenated message stream without framing information.

Articles by others on the same topic (0)

There are currently no matching articles.