Adds nodes to a min heap containing letters and frequency and generates the appropriate huffman code, computers the weight for each letter, and also calculates the weighted path length of the code.