Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please write python thank you Compression (Encoding) - Read the characters from text file - Construct the LZW dictionary - Generate the output - Encode

image text in transcribedimage text in transcribed

please write python

thank you

Compression (Encoding) - Read the characters from text file - Construct the LZW dictionary - Generate the output - Encode the symbols in the input file - Save the compressed file - Calculate code length and compression ratio Decompression (Decoding) - Read the stored data - Restore the LZW dictionary - Restore the symbols from the compressed data - Save the restored text - Compare the original and restored text Level 1 actions-details: Compression (Encoding) - Read the characters from text file - Construct the LZW dictionary by using the LZW compression algorithm - Generate the output codes in the form of an integer array - Convert integer array to a binary string by extracting codelength bits from each integer - If the length of the binary string is not a multiple of 8 , add zeros to the string (padding) - Add a 8 bits to the beginning of the string to indicate the number of zeros added to the end of the string - Now the_string_length %8=0 - Extract bytes in the string and write them into a binary output file (compressed file) - Calculate code length and compression ratio Decompression (Decoding) - Read the bytes from binary file (compressed file) - Construct the LZW dictionary by using the LZW compression algorithm - Generate the output codes in the form of an integer array - Convert integer array to a binary string by extracting codelength bits from each integer - If the length of the binary string is not a multiple of 8 , add zeros to the string (padding) - Add a 8 bits to the beginning of the string to indicate the number of zeros added to the end of the string - Now the_string_length %8==0 - Extract bytes in the string and write them into a binary output file (compressed file) - Calculate code length and compression ratio

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago