Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use the Lemple-Ziv-Welch (LZW) algorithm to encode the following ascii text: EEEEEEEEEE. Assume that the input (ascii) is 8 bits and the output encoding is
Use the Lemple-Ziv-Welch (LZW) algorithm to encode the following ascii text: "EEEEEEEEEE". Assume that the input (ascii) is 8 bits and the output encoding is 9 bits, so codes 256 to 511 may be used for strings. Show both the output and the entries in the string table. Show the output and calculate the % space savings. The code and an example are provided below.
Routine Lzw cOMPRESS 1. STRING get input character 2. WHILE there are still input characters DO CHARACTER-get input character IF STRING+CHARACTER is in the string table then STRING STRING character ELSE output the code for STRING add STRING+CHARACTER to the string table STRING CHARACTER 10. 11. END of WHILE 12. output the code for STRING END of IF Input String = /WED/WE/WEE/WEB/NET Character Input Code Output New code value New String 256 257 258 259 260 261 262 263 264 265 266 WE WE 256 WEE 260 261 257 E/W WEB B/ WET EB 260 Routine Lzw cOMPRESS 1. STRING get input character 2. WHILE there are still input characters DO CHARACTER-get input character IF STRING+CHARACTER is in the string table then STRING STRING character ELSE output the code for STRING add STRING+CHARACTER to the string table STRING CHARACTER 10. 11. END of WHILE 12. output the code for STRING END of IF Input String = /WED/WE/WEE/WEB/NET Character Input Code Output New code value New String 256 257 258 259 260 261 262 263 264 265 266 WE WE 256 WEE 260 261 257 E/W WEB B/ WET EB 260Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started