Algoritma LZW Compression
Algoritma LZW Compression
BEGINs = next input character;
while not EOF
{ c = next input character;
if s + c exists in the dictionary
s = s + c;
else
{ output the code for s;
add string s + c to the dictionary with a new code;
s = c;
}
}
output the code for s;
END
Contoh Soal :
Diketahui Simbol {0,1} dengan menggunakan LZW.
Tunjukkan Dictionary & Output Dari Simbol 0110011
Penyelesaian:
S C Output Code String
A 0
B 1
0 1 A C 01
1 1 B D 11
1 0 B E 10
0 0 A F 00
0 1
01 1 C G 011
1 EOF B
Output dari Symbol 0110011 = ABBACB
Dictionary = 01,11,10,00,011
C, D, E, F, G
Filed under: Kuliah


kalo source code algoritma LZW yang pakai bahasa delphi ada ga? kan itu ada path merubah huruf/angka ke biner kan?aq butuh bwt TA ni. trims