implementation of huffman coding algorithm