问题标题: 关于字符串压缩

0
0
包思远
包思远
新手启示者
新手启示者

使用哈夫曼进行压缩,结果:

哈夫曼表:
Huffman Codes:
#: 11110011100
$: 11110011110
%: 0111000
&: 1111001000
0: 100001
1: 11000
2: 11010
3: 01011
4: 001110
5: 011101
6: 1110101
7: 001001
8: 1100111
9: 01111
A: 111100101
B: 111101
C: 1000001
D: 1100110
E: 100100
F: 00011
G: 0011110
H: 010000
I: 10011110
J: 011000
K: 0111001
L: 111011
M: 011001
N: 10101
O: 10110010
P: 1111001001
Q: 101001
R: 00101
S: 001000
T: 110110
U: 11111
V: 01101
W: 01001
X: 1111000
Y: 100110
Z: 11100
a: 10001
b: 101101
c: 10111
d: 01010
e: 1011000
f: 0011111
g: 11110011111
h: 1110100
i: 0100011
j: 100101
k: 110010
l: 0000
m: 001100
n: 000100
o: 10110011
p: 000101
q: 01000101
r: 111100110
s: 01000100
t: 1000000
u: 11110011101
v: 110111
w: 001101
x: 10011111
y: 1001110
z: 101000


//压缩后
Compressed Text: `/O`]==98'8IOJ'0,$X$!_2CP*J1>4X/?P_DW.6'/&GDWSW1^=><A"J:-1'Q3<I
FO[B_O_HV`BBC<OOI.UJH!/)T;HFJ]5U48#OI^U-4%%0@RJYZZ;5C?SF7->0?0:T4+`6FD6;,F<.1LT@
(VPE[6$VFM&ZRS<[PSHP&=CDSV%08$6:A^`C3!:7#_/W2O[V%T1G\NCH65642ST3FUY.)%+S>_=`_T7$
'Q54@FB#?X@NA*%Z/ZL=M<+EVUTR;?D]H?_7*;LHN_:FX>_1_SV3(6H434TV'XQ6@^6:JQ!5+%G[\]F:
8XKPYW"DT8-(#W]Z^H_[/!=CV%^N\]Z<V!)U[&Z_(!LGFW&_EDL`G,LFNLT9TFO-]>BF0[PE\THCVCJ,
:)"&05B_KE[@8EBO\@";9_09R%Z(G:;N8%LJ)!:?8HE]*3\G\IT]H(8R&OGQ8J5ARMHR.$2XDXLKM,&9
?"UP:\,0W'H@`)`B2DBMM>THH@-KCR(8+O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zdwL2o3aLb3RYSlljV3HNaZF6A3c6%G
R3QL1pckL2RWSkwvc6it2UHB1blRQ2dlBCTllqK3BaL2ZRdFBKWllieFRjcnZaKzN0vL71o9z1MFpmL2
8vZ9nJiUHMzaXBZVGdTZFhKUXMvdlV%tcjcvc3BK2

感觉没短多少

包思远在2024-12-14 18:03:38追加了内容

压缩前的字符串为1.38KB,压缩后的字符串为1.30KB(作为对比,在windows上进行ZIP压缩后字符串大小为1.25KB)


0
0
0
0
我要回答