All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
Shrink needed (Posted on 2006-10-18) Difficulty: 2 of 5
A file compressor is great for shrinking stored files, but it depresses me whenever I see a file grow instead of shrink. So what I am looking for is a file compression algorithm that never inflates any files, although it is allowed that some files (not all of course!) have the same length after "compression". Ideally it should work on files of all sizes, but I would be satisfied with a compressor that operates only on files larger than 1MB. Can you provide such an algorithm? No programming knowledge is required for this problem.

See The Solution Submitted by JLo    
Rating: 3.6667 (6 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution A tricky way out | Comment 20 of 26 |
All the impossibility proofs would fail if, given a file, the unzipper could recognize whether it corresponds to a zipped file or not.

If you allow using the NAME (or extension) of the file to this purpose, a zipper as wanted would be:

1. Take the file to be zipped
2. Try to compress it by any algorithm you may imagine
3. If the file doesn't end smaller, forget it, leave the file as it was, don't touch it.
4. If, however, the file ends smaller, add a ".ZIPPED" (or whatever) extension to its name, with the proviso that this new added extension should never be used for any other purposes by any other program.

When unzipping:
1. If the extension ISN'T ".ZIPPED", leave it alone.
2. If the extension IS ".ZIPPED", then uncompress the file, and rename it by removing the ".ZIPPED" extension.

  Posted by Federico Kereki on 2006-10-21 14:34:11
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (14)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information