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.
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!