Consider the table above that represents the frequencies of…
Consider the table above that represents the frequencies of characters in a document. Now, if you apply huffman encoding on this table, the encoded representation of each of the characters will be: Steps of Huffman Encoding: START Put all characters and their frequencies in a list. WHILE there is more than one node in the list Select the two nodes with the smallest frequencies. Join them into a new node. New frequency = first frequency + second frequency. Put the new node back into the list. END WHILE The last remaining node is the root of the Huffman tree. Assign: 0 to every left branch 1 to every right branch The code for each character is the path from the root to that character. STOP
Read Details