Answered step by step
Verified Expert Solution
Question
1 Approved Answer
we want to compress more if possible. To do this, we take advantage of the fact that characters do not usually occur with the same
we want to compress more if possible. To do this, we take advantage of the fact that
characters do not usually occur with the same frequency in a text. We now want to encode the characters
in such a way that
we use short bit sequences for frequent characters and then disproportionately long bit sequences for rare
characters. We choose a simple division for this. A bit sequence is always a character if the number of bits
is odd and has a at the end. However, this also means that s can otherwise only occur in even
positions. This results in a unique coding, even if all bit sequences are simply added one after the other.
This results in the following possible bit sequences, listed in order of length from left to right and top to
bottom. coded.
We can see that we can display one character with one bit, two characters with three bits, four characters
with five bits, eight characters with seven bits, characters with nine bits, characters with bits and
characters with a maximum of bits.
We now need to specify the characters in the compressed file at the beginning in their order of frequency.
We start with a byte that specifies the number of occurring characters, then with all characters, one per
byte, in the order sorted by frequency, if it occurs. This is followed by the characterbycharacter
translated text with bit patterns of different lengths. We end with en if there is still room, otherwise we
would always have the most frequent character at the end.
To implement the possible bit patterns from above, you can work with a vector as a work
queue. You take out a bit pattern at the beginning and delete it If the bit pattern is odd long and has a at the
end, then add it to the bit patterns for translated characters. If not, then add a bit pattern like the extracted
one with an additional at the end and one like the extracted one with an additional at the end. Do this until
you have a sufficient number of bit patterns. Bit patterns of length inclusive are sufficient. please explain this task further and more deeply
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