Simple implementation of huffman algorithm