Every classic compressor faces a quiet tax. Huffman coding is optimal if you insist on giving each symbol its own bit-string — but a bit-string has a whole number of bits. If a symbol's ideal length is 1.3 bits, Huffman has to round up to 2, and that rounding adds up over millions of symbols.
Arithmetic coding simply refuses to play that game. Instead of a codeword per symbol, it represents the entire message as a single number in the interval [0, 1). Each symbol narrows the interval in proportion to its probability, and at the end you write down enough binary digits to pin down a point inside the final sub-interval.
The payoff: the average cost approaches the message's true entropy — the theoretical floor set by Claude Shannon in 1948 — including fractional bits per symbol. Where Huffman rounds, arithmetic coding glides.
Comments
Loading comments...