让我们用这首诗实验Huffman编码: You're my man, my mighty king, And I'm the jewel in your crown, You're the sun so hot and bright, I'm your light-rays shining down, You're the sky so vast and blue, And I'm the white clouds in your chest, I'm a river clean and pure, Who in your ocean finds her rest, You're the mountain huge and high, I'm the valley green and wide, You're the body firm and strong, And I'm a rib bone on your side, You're an eagle flying high, I'm your feathers light and brown, You're my man, my king of kings, And I'm the jewel in your crown. Nima Akbari
在这首诗中字符出现的频率: N 1 - 1 . 1 W 1 p 1 j 2 v 3 A 5 f 5 k 5 c 6 b 7 Y 7 I 8 w 8 l 11 g 15 ' 15 s 15 d 17 y 17 , 17 m 18 t 20 u 20 CR 21 a 22 h 24 i 26 o 30 r 30 n 38 e 39 SP 89
相应的Huffman编码树:
写下出现频率最高的 SP 字符和次出现频率最高的e字符的的Huffman编码。
在这里查看单个字符的Huffman编码:
| 返回互动演示 |