Huffman-Code (HC)

When using Huffman-Trees for coding the letters are listed with their frequencies to become the leaves of a tree being constructed bottom-up. The two parentless nodes with the lowest frequency become the children of a new created node being assigned the sum of its children's frequencies. This step is repeated until the root is the only remaing parentless node. For each parent node the left path is assigned a 0 and the right path a 1.
When encoding, each letter searches its path through the tree receiving the bits read top-down as its code.
When decoding, the bit string searches its path to a leaf top-down receiving its content as decoded text.

Applet's Usage:

Go back to Lossless Compression

Go on to my German Documentation

Written by: Oliver Schmid © May 2002