Answered step by step
Verified Expert Solution
Question
1 Approved Answer
To implement the compression algorithm that matches the decompression algorithm from Program from Program 1 To use file I/O in C++ (open, read a char,
- To implement the compression algorithm that matches the decompression algorithm from Program from Program 1
- To use file I/O in C++ (open, read a char, test for eof).
- To use an acceptable coding style: no goto, no global variables, proper indentation, and reasonable names.
- To understand and use a type cast to create a 1-byte integer
1.1Review: Run Length Compression
This algorithm is effective on text or binary files that have the same byte repeated over and over.Think of a file containing a table of numbers:it has lots of consecutive space characters, and may havea repeated filler character, such as a '.' .
In this scheme, any "run" of the same character (4 or more identical consecutive bytes) is replaced by a triplet of bytes, consisting of
- An escape character. We will use 0x7f, which is sometimes called "esc". It is a non-printing ASCII character
- The letter that has been repeated
- A 1-byte count = the number of repetitions
To make this work, any esc character, or run of them, that occurs in the input mustalsobe replaced by a triplet: esc esc count .
Step 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