Co-founder @ SMERGERS and WealthBox.in

Huffman Encoding 18-Jan-2009

Huffman coding is a variable length encoding technique. More about it can be found here.
This program accepts the characters and their probability as the input. and generates the Huffman codes for each of the characters. I have used a Linked list which slowly transforms into a tree thereby creating the Huffman Tree. The codes are obtained by the inorder traversal.

For testing i prefer redirecting a file as input. So i'm attaching the input file as well.. One can do the same..

$ g++ huffman.cpp

$ ./a.out < huffman.input

Here's the input file


blog comments powered by Disqus