huffman encoding

Introduction
Huffman coding is an encoding mechanism by which a variable length code word is assigned to each fixed length input character that is purely based on their frequency of occurrence of the character in the text to be encoded.
It is common to assign shorter codes to more frequent characters and the less frequent characters are assigned longer code words. A code word is a binary string (a sequence of zeroes and ones).
A Huffman tree is made for an input string and characters are decoded based on their position in the tree. The decoding process is as follows:
We start from t...