A prefix code assigns valid sequences so that no sequence is the prefix of another. This makes compressed data immediately decodable: each complete sequence identifies one character without separators. section 2.8.3
Huffman coding constructs prefix codes with a binary tree:
- Traverse left edges by adding 0 and right edges by adding 1 to the sequence. section 2.8.3
- Use shorter sequences for more frequent characters, supporting efficient compression. section 2.8.3
Decoding 1001101
Following the tree, 10 decodes as B, 0 as A, and 1101 as D, producing “BAD”. The prefix property makes each boundary unambiguous. section 2.8.3
