将hello world进行香农编码的结果: 字符串 chars:l freq:0.250000 sum_freqs:0.000000 encode_length:2 encoding:00 chars freq:0.166667 sum_freqs:0.250000 encode_length:3 encoding:010 chars: freq:0.083333 sum_freqs:0.416667 encode_length:4 encoding:0110 chars:! freq:0.083333 sum_freqs:0.500000 encode_length:4 encoding:0111 chars:r freq:0.083333 sum_freqs:0.583333 encode_length:4 encoding:1001 chars:h freq:0.083333 sum_freqs:0.666667 encode_length:4 encoding:1010 chars:e freq:0.083333 sum_freqs:0.750000 encode_length:4 encoding:1100 chars:w freq:0.083333 sum_freqs:0.833333 encode_length:4 encoding:1101 chars:d freq:0.083333 sum_freqs:0.916667 encode_length:4 encoding:1110
|