Implementation of huffman algorithm