Description:
Huffman coding
The product of the given n right nodes construct the Huffman tree, the output of all n-vertex weights and their Herman coding length (that is, the junction depth in the constructed Herman tree,). combined.
Input
The first line is a positive integer n represents a total of n nodes.
The second line of n integers, respectively, an n-vertex weights.
Output
Output of all n-vertex weights and their coding Herman length sum of the products.
Sample Input
5
12259
Sample Output
37
To Search:
File list (Check if you may need any files):
Haffman.cpp