-->
当前位置:首页 > 题库

PROGRAMMING:Huffman tree

Luz5年前 (2021-05-10)题库426
Huffman tree, the first line input a number n, the number of leaf nodes.
According to the concept of Huffman tree, these nodes have weight, that is, weight. The topic needs to output the weighted path length (WPL) of Huffman tree.
###Input format:
Enter a number N in the first line and N leaf nodes in the second line (the weight of leaf node is not more than 1000, 2 < = n < = 1000).
###Output format:
Output WPL values on one line.
###Input example:
```in
five
1 2 2 5 9
```
###Output example:
```out
thirty-seven
```







answer:If there is no answer, please comment