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 No impossibility | Comment 15 of 26 |
The zipper replaces one (arbitrarily chosen but fixed) file by a file of length 0, and leaves all others unchanged. The unzipper knows that the compression only works for files above a certain minimum size (say, 1MB) and has the special fixed file hard-coded into it, so it can restore all files.

This method analogously works for files which are at least 1 byte in length.  And because we map one file to a zero-length file, not all files remain the same size after compression.

The requested compression algorithm is a one-to-one map from files above a certain size to the set of all files, which is its (genuine) superset.  So by imposing a minimum uncompressed file size, one can fulfil the criteria requested in the problem.


  Posted by vswitchs on 2006-10-20 16:50:57
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 (3)
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