Huffman tree building logic added