Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are–by definition–not smart enough to debug it. Brian Kernighan
Huffman coding is a lossless data compression algorithm and derives this table based on the estimated frequency of occurrence for each possible value of the source symbol.
The most frequent character gets smallest code and least frequent character get the largest code. Two trees with the least frequencies are joined as the subtrees of a new root that is assigned the sum of their frequencies. Repeat until all characters are in one tree. One code bit represents each level. Thus more frequent characters are near the root and are coded with few bits, and rare characters are far from the root and are coded with many bits.
Write program to implement Huffman coding?
Huffman code for 'Hello World' char Weight HuffmanCode 1 000 r 1 001 e 1 010 W 1 011 l 3 10 o 2 110 H 1 1110 d 1 1111