4、,你就需要通过一个平衡的哈夫曼树来表示。例如,字符串“aaabbbcccddd”的表示将会是如下形式的哈夫曼树:通过查找上图中的哈夫曼树可知,字符串“abcd”将会编码成“00011011”。哈夫曼树的这种特性非常重要。程序分析当你运行程序时,它将提示你输入,在你输入相应内容之后,它将输出一堆毫无意义的东西(尽管输出使我们理解变得简单多了)。可以看下这个例子:$ echo 'this is a test string'
7、sTwo lowest frequencies: 0.000000 and 0.000000Two lowest frequencies: 0.000000 and 0.000000Two lowest frequencies: 0.000000 and 0.000000Two lowest frequencies: 0.000000 and 0.022727Two lowest frequencies: 0.022727 and 0.022727Two lowest frequencies: 0.022727 and 0.022727Two l
8、owest frequencies: 0.022727 and 0.045455Two lowest frequencies: 0.045455 and 0.068182Two lowest frequencies: 0.068182 and 0.090909Two lowest frequencies: 0.090909 and 0.113636Two lowest frequencies: 0.113636 and 0.113636Two lowest frequencies: 0.159091 and 0.181818Two lowest
9、frequencies: 0.204545 and 0.227273Two lowest frequencies: 0.227273 a