Huffman Coding Algorithm

This technique was developed by David Huffman.

The code are generated using the Huffman technique or procedure is called Huffman codes.The codes are prefix codes and are optimum for a given model.

Assigning codewords to the modeled data is known as coding.

Huffman Coding Algorithm:

Huffman coding algorithm is a bottom up approach, steps of the algorithm are as follows:-

Step 1  Put all symbols on a list sorted according to their frequency count.

Step 2  Repeat until the list has only one symbol left:

(a)From the list, pick two symbols with the lowest frequency counts.From a Huffman subtree that has these two symbols as child nodes and create a parent node.

(b)Assign the sum of the children's frequency counts to the parent and insert it into the list such that the order is maintained. 

(c)Delete the children from the list.

Step 3 Assign a code word for each leaf, based on the path from the root.

Comments