Founder & CTO @SMERGERS & @wealthrox
Past - Dev Infra @Google · RF @NI · CS @USC

Currently
Founder & CTO @SMERGERS & @wealthrox
Previously
Dev Infra Intern @Google NYC RF @NI-WCDMA
Computer Science @USC
Contact
hey [at] krishnabharadwaj.info
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