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