Apply Huffman coding. Combining weights
gives, for example,
Any consistent interchange of siblings is equivalent.
For the binary code above, the lengths are . Thus
This is optimal by Huffman coding.
The ternary merges are , then , then . One code is
Its expected length is

Articles by others on the same topic (0)

There are currently no matching articles.