Huffman coding: Difference between revisions

Content deleted Content added
Small alphabets create problems; alternating between codes can provide a solution. Also sectionified it and explained the basis behind Huffman Template.
replaced one way of compensating for small alphabets that it turns out doesn't work with one that does
Line 38:
Huffman coding is optimal when the probability of each input symbol is a power of two.
Prefix-free codes tend to have slight inefficiency on small alphabets, where probabilities often fall between powers of two.
Expanding the alphabet size by coalescing multiple symbols into "words" before Huffman coding can help a bit.
[[Arithmetic coding]] produces slight gains over Huffman coding, but in practice these gains have not been large enough to offset arithmetic coding's higher computational complexity and patent royalties ([[As of 2001|as of November 2001]], IBM owns patents on the core concepts of arithmetic coding in several jurisdictions).
In addition, alternating between Huffman codes for symbols in even and odd positions can in effect allocate fractional numbers of bits, improving results in small-symbol alphabets.
 
== Applications ==