Constructing Huffman Tree and its coding