You are on page 1of 2

Dwi Putri Wahyuningsih

2019390004

Dictionary Coding 2

The output of the LZW encoder is the following sequence:

6 3 4 5 2 3 1 6 2 9 11 16 12
14 4 20 10 8 23 13

Decode the sequence using the initial dictionary below:

Index Entry
1 A
2 Y
3 H
4 I
5 S
6 T

Answer:

CODE OUTPUT NEW CODE NEW STRING


6 T
3 H 7 TH
4 I 8 HI
5 S 9 IS
2 Y 10 SY
3 H 11 YH
1 A 12 HA
6 T 13 AT
2 Y 14 TY
9 IS 15 YI
11 YH 16 ISY
16 ISY 17 YHI
12 HA 18 ISYH
14 TY 19 HAT
4 I 20 TYI
20 TYI 21 IT
10 SY 22 TYIS
8 HI 23 SYH
23 SYH 24 HIS
13 AT 25 SYHA
The encode message is THISYHATYISYHISYHATYITYISYHISYHAT

You might also like