Welcome to The Animation on


HUFFMAN ENCODING AND DECODING

Guidelines of viewing the Applet of Huffman

Animation on Huffman Encoding And Decoding

How Huffman Algorithm works

A Huffman code is a block-to-variable code. It makes use of the probability of the appearance of each character. Symbols with least probabilities get longer codes and vice versa. The algorithm required to build Huffman code varies the length of the code words in order to match them to their probabilities. In any frame, the characters transmitted will be analysed and determined of each character's probability. The processes in the animation of Huffman Coding starts with a display of already sorted nodes with the assigned probability. There are two main processes that are vital to animation, namely merging and sorting. The merging of trees are always done first on the sorted list of trees. The merging of trees are done to the two least probable trees or symbols. This can usually been viewed on right hand side of the list when user clicks the next button. At the completion of the merging process, the next process that follows is the sorting of the new merged tree. Sorting is done in descending order of the probabilities. The algorithm used will sort the new merged tree into the list until next left node's probability is equal or greater than the merged tree's probability. Well the sorting and merging stops when the next left symbol's probability has the same with probability with the probability of the new merged tree. Therefore the process of sorting stops at that position. However if the second algorithm is used, different nodes positions will be obtained.

Source Code: Huffman_tree Example Huff HuffmanCanvas Binary

 

Animated By Deepak Malhotra