kb

 

Krishna Bharadwaj

Geek, programmer, foss enthusiast, loves Python, Ex-Microsoft Student Partner, Ex-National Instruments.
You can Subscribe to my blog, Follow me on twitter

Huffman Encoding

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

←Unforgettable Day!         Kb!! - Designer Vs Developer ;) →

blog comments powered by Disqus
pony powered