Answered step by step
Verified Expert Solution
Link Copied!

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,

  1. To implement the compression algorithm that matches the decompression algorithm from Program from Program 1
  2. To use file I/O in C++ (open, read a char, test for eof).
  3. To use an acceptable coding style: no goto, no global variables, proper indentation, and reasonable names.
  4. 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

  1. An escape character. We will use 0x7f, which is sometimes called "esc". It is a non-printing ASCII character
  2. The letter that has been repeated
  3. 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

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

1. Socialization policy in mass media?

Answered: 1 week ago

Question

1. What is employment? 2. What is the rewards for employment?

Answered: 1 week ago