n-ary Huffman coding
lesswrong.com·2h
Flag this post

Published on November 9, 2025 5:05 AM GMT

Huffman coding is a method for constructing optimal prefix codes!

Codes and trees

As previously alluded to on this blog, a code represents an implicit set of beliefs about the frequency distribution of different kinds of text. Longer codewords represent lower implied frequencies. Prefix codes give each symbol in the alphabet a fixed codeword with a fixed length, so the implied beliefs include "the probability of a symbol is independent of whatever came before it"; this is obviously not true, but it simplifies the encoding and decoding process immensely. Prefix codes are designed so that no delimiters are needed between codewords; no codeword is a prefix of another, so it's never ambiguous whether you've reached the end o...

Similar Posts

Loading similar posts...