0 0
Read Time:2 Minute, 56 Second

LZW Decoding using Dictionary

Question
The decode the receives sequence “3,2,5,7,8,5,3,6,10,9,5,6,12,11,5” using lzw dictonary coading if the initial dictonanry has four entries {a,e,o,u} in their alphabetical sequence.

Answer

LZW Decoding using Dictionary

To decode the received sequence using LZW dictionary coding, we need to apply the following steps:

Step 1: Initialize the dictionary with the four entries {a, e, o, u} in their alphabetical sequence.

Step 2: Read the first symbol from the received sequence, which is 3. Look for the corresponding entry in the dictionary and output it, which is “u”.

Step 3: Read the second symbol from the received sequence, which is 2. Look for the corresponding entry in the dictionary and output it, which is “e”.

Step 4: Read the third symbol from the received sequence, which is 5. Look for the corresponding entry in the dictionary and output it, which is “o”.

Step 5: Read the fourth symbol from the received sequence, which is 7. Look for the corresponding entry in the dictionary and output it, which is “ue”.

Step 6: Read the fifth symbol from the received sequence, which is 8. Look for the corresponding entry in the dictionary and output it, which is “ua”.

Step 7: Read the sixth symbol from the received sequence, which is 5. Look for the corresponding entry in the dictionary and output it, which is “o”.

Step 8: Read the seventh symbol from the received sequence, which is 3. Look for the corresponding entry in the dictionary and output it, which is “u”.

Step 9: Read the eighth symbol from the received sequence, which is 6. Look for the corresponding entry in the dictionary and output it, which is “oe”.

Step 10: Read the ninth symbol from the received sequence, which is 10. The corresponding entry is “ueo”, but it is not yet in the dictionary. Therefore, output the previous entry (“oe”) followed by its first symbol (“u”), which is “oeu”. Add this new entry to the dictionary.

Step 11: Read the tenth symbol from the received sequence, which is 9. The corresponding entry is “uao”, but it is not yet in the dictionary. Therefore, output the previous entry (“ua”) followed by its first symbol (“o”), which is “uao”. Add this new entry to the dictionary.

Step 12: Read the eleventh symbol from the received sequence, which is 5. The corresponding entry is “o”, which is already in the dictionary. Output it.

Step 13: Read the twelfth symbol from the received sequence, which is 6. The corresponding entry is “oe”, which is already in the dictionary. Output it.

Step 14: Read the thirteenth symbol from the received sequence, which is 12. The corresponding entry is “ueoe”, but it is not yet in the dictionary. Therefore, output the previous entry (“ueo”) followed by its first symbol (“e”), which is “ueoe”. Add this new entry to the dictionary.

Step 15: Read the fourteenth symbol from the received sequence, which is 11. The corresponding entry is “uaoa”, but it is not yet in the dictionary. Therefore, output the previous entry (“uao”) followed by its first symbol (“a”), which is “uaoa”. Add this new entry to the dictionary.

Step 16: Read the fifteenth symbol from the received sequence, which is 5. The corresponding entry is “o”, which is already in the dictionary. Output it.

Step 17: We have reached the end of the received sequence, and therefore the decoding process is complete.

Therefore, the decoded sequence is “ueouaeouoeueoeuaoao”.

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

One thought on “LZW Decoding using Dictionary

Leave a Reply

Your email address will not be published. Required fields are marked *