0

# Compression of a file

I am so curious to know how a large file is compressed and extracted after some time

7 Answers

+ 1

I've had problems extracting from RAR files with some sort of corruption and end up with an error and usually some hex and lots of zeros

0

Take this sequence of numbers.
0000444446655553677
That is 20 numbers long
But you could also write it as
4*0,4*5,2*6,5*5,36,2*7
So by saying there are 4 zeros, followed by 5 fours then 2 sixes etc....
You go from 20 numbers long to 12 numbers. That's a very basic way of compressing a file.

0

What about texts where the letters are not in a sequence and moreover it can even contain numbers.How to extract that?

0

It's a similar method, a good compression algorithm would count how many A,B,C etc & 1,2,3 etc...so it would be this file has 36 A character in it 45 zeros etc... then entered into an array to keep track of the line that character/number is on.
I'm just not sure exactly how to go from that to extracting it into its original form.
Perhaps try and find currently written compression algorithms and learn from that.

0

Thank you đ

0

Thanks for the post on the topic Kit Delano Cat, I'll certainly check it out.

0

Use python zip module