File compression | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

File compression

"the program should be able to compress a file into a list of words and list of positions to recreate original file. it should be able to take a compressed file and recreate the full text of the original file."

6th Mar 2017, 9:52 PM
aisha
2 Answers
+ 16
This is called "lossless compression". The file can be compressed and then uncompressed without any data from the original file being lost... as opposed to "lossy compression" where each time, some amount of data is lost (like YouTube video compression). The compression algorithm itself should be able to search for repeating patterns like "And" and storing the patterns along with indexes of where to find these patterns. Then, when the file is being uncompressed, it goes through each pattern and puts them back where they belong. As a simple example, take this: "jjjhhhhhwwww" you can compress it to: "j3h5w4" That's all the information you need.
6th Mar 2017, 10:37 PM
Aidan Haddon-Wright
Aidan Haddon-Wright - avatar
+ 3
So you want us to do that? Nope
6th Mar 2017, 10:05 PM
Amaras A
Amaras A - avatar