|
|
|
|
|
by vitus
819 days ago
|
|
You're missing an important detail of Huffman codes: they need to be prefix-free so you can actually tell when one value ends and another begins. A simplified example: suppose you have four letters in your alphabet that you want to represent in binary. You can't just represent these as A=0, B=1, C=10, and D=01, since it's impossible to tell whether "01011" is meant to represent ABABB or DDA or ACBB. (Hamming codes on the other hand are intended for error correction, where you want maximally distant code words to minimize the chance that bitflips cause decoding errors.) |
|
That's really a problem inherent to binary streams in general, not just Huffman encoding.