Contact MeContact Me

JavaScript Huffman Code Demo

What is Huffman code?

Huffman code is a lookup table that's generated by a compression scheme known as the Huffman algorithm. While the table itself is only a part of the complete algorithm, it's probably the most challenging component to grasp. It is a binary tree that stores values based on frequency. The more frequent the value, the closer to the root it is located and the smaller its binary representation. Once the lookup table is created, it is used to compress the data, and subsequently to decompress it.

The Huffman algorithm is used in conjunction with many popular compression methods like LZ, ZIP, GIF, and JPEG. There are also other flavors of the algorithm including Adaptive Huffman and Modified Huffman.

Input

Enter some text then click Submit to create a binary tree:

Output


[Click Submit above to generate the tree]

statCollector