Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Dwi Putri Wahyuningsih

2019390004

HW-Dictionary Coding

Encode the "ABRACADABRA" using the LZW algorithm with the 5 initial entries to the
dictionary as provided in the class.

A=1

B=2

C=3

D=4

R=5

String Output Code New String


A 1 6 AB
B 2 7 BR
R 5 8 RA
A 1 9 AC
C 3 10 CA
A 1 11 AD
D 4 12 DA
AB 6 13 ABR
RA 8

Encode = 1 2 5 1 3 1 4 6 8

You might also like