Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have texts that consist only of alphanumeric characters without capital letters and some special characters including the space character. abcdefghijklmnopqrstuvwxyz 0 1 2 3

You have texts that consist only of alphanumeric characters without capital letters and some special
characters including the space character.
abcdefghijklmnopqrstuvwxyz0123456789\t
-/,;.:!?"'()
We want to compress these texts without loss using various methods. This means that we want to create a
file from a .txt file that takes up less space than the original, but from which the original content can
be reconstructed. We select the method and whether we want to compress or decompress with a flag.
Otherwise we always have two position parameters, the first parameter is the input file, the second
parameter is the output file. All positional parameters (command line arguments without - at the
beginning) are regarded as path fragments to be processed, including file names. You may omit the second
parameter, in which case a name as in the task definition is selected as the file name, depending on the
procedure. Always enter the time required for the actual compression process (without reading and
saving).
Task 1(2P) We have more than 32 but less than 63 characters, so we only need 6 bits instead of 8 bits to
represent all the characters. The first method thus reduces the size. Each character of 8 bits is replaced by a
character of 6 bits and all bits come directly after each other. Depending on the number of characters, this
may mean that not exactly one byte comes out at the end. We then simply fill it up with 0-en. The only case in
which we can have an ambiguity is if the last 6-bit word extends into the next byte with 2 bits, leaving exactly 6
bits. Then the last 6 bits are potentially another 6-bit word. However, if we make sure that the 0-bit does
not occur 6 times as a correct character, then we can recognize the case. To do this, we simply have to
start with 000001 instead of 000000 to exclude 000000 as a valid 6-bit word. We use the bit
patterns in ascending order as above, so a is equivalent to 000001 and so on. For example, the text abc
is used as the bit pattern 011000010110001001100011 to 000001000010000011000000, with
the spaces inserted after 8 bits for readability only. In the example, 60's have been inserted at the end
If you implement the procedure using a vector, you will learn how to handle bit sequences. We
compress with the -a flag and decompress with the -b flag. When compressing, we simply add the extension
.kompein to the file name if the output file is not specified. When decompressing, we use out.txt if
the output file name is not specified. We abort with an error message if the input is not expected.
please use c++ and make it as simple as possible using #include
#include //cuz vector
#include
#include //error

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

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

explain what is meant by redundancy

Answered: 1 week ago