huffman树编码与解码??
The Unanimous Declaration of the Thirteen United States of America . When, in the course of human events, it becomes necessary for one people to dissolve the political bonds which have connected them with another, and to assume among the powers of the earth, the separate and equal station to which the laws of nature and of natures.God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation.
下面为每个字母出现的次数:
a 26
b 2
c 13
d 4
e 48
f 7
h 26
i 20
k 1
l 9
m 11
n 25
o 29
p 9
q 2
r 17
s 25
t 41
u 11
v 3
w 6
y 2
" " 73
, 5
. 3
对上面这一段进行编码和解码。现在不明白怎么搞,感觉画不成二叉树,都变三叉了。
按照什么来编码?等等。。
[解决办法]
http://dev.csdn.net/article/19/19580.shtm
[解决办法]
总的来说就是让出现次数高的字母的码短,huffman这个家伙提出一个组成二叉数的方法来实现。