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 zipper exists | Comment 13 of 26 |
After reading e.g.'s proofs, I came up with a "reverse" proof that shows that a zipper as asked by JLo is impossible.

Start with the 0 bytes long files -- there's just one! Obviously, the zipper cannot compress it at all.

Now, move on to the 1 byte long files -- 256 of them. No file can be compressed to 0 bytes, for then the unzipper, when given a 0 bytes long file, wouldn't now whether to "expand" it into the 0 bytes long file or the 1 byte long file. Thus, the zipper cannot compress any 1 byte long file, and can at most "switch them around", but always producing a 1 byte long output file for each 1 byte long input file.

Now, the same argument applies for 2 bytes long files (256^2 of them), which cannot be compressed to either 0 or 1 bytes... and, by induction, to any length files.

Looking for zipping algorithms is a waste of time!

  Posted by Old Original Oskar! on 2006-10-20 09:41:12
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