FactSet Interview Question

implement a Huffman tree in the Algorithm part