FactSet interview question

implement a Huffman tree in the Algorithm part