Puzzle time: Compression
-
Somewhat related to Jon's most recent puzzle.
We all know zip files and the like: Their purpose is to reduce the size of data in such a way that the original data can be reconstructed (usually known as lossless compression).
Sometimes, however, something funny happens: When you try to compress a file, the compressed version is actually bigger than the original data.
My question is this: Can there be a lossless compression method that does not suffer from this property: It reduces the size most of the time but the compressed version is never bigger than the original (not even by one bit).
-
I don't think so. It's tempting to say that if the compressed size was larger, you'd just switch to an identity compression algorithm, but you'd have to add info to the 'identity compressed' data to indicate that it's unaltered from the original. That information can't be carried at zero size.
-
Seems like it’s impossible based on the pigeon hole principle alone. If the mapping of uncompressed to compressed is reversible then some files must be larger.
@jon-nyc said in Puzzle time: Compression:
Seems like it’s impossible based on the pigeon hole principle alone. If the mapping of uncompressed to compressed is reversible then some files must be larger.
Exactly. There is no bijection between sets of different cardinality.
-
I don't think so. It's tempting to say that if the compressed size was larger, you'd just switch to an identity compression algorithm, but you'd have to add info to the 'identity compressed' data to indicate that it's unaltered from the original. That information can't be carried at zero size.
@horace said in Puzzle time: Compression:
I don't think so. It's tempting to say that if the compressed size was larger, you'd just switch to an identity compression algorithm, but you'd have to add info to the 'identity compressed' data to indicate that it's unaltered from the original. That information can't be carried at zero size.
That’s why I added the condition that it cannot be even one bit larger. With one extra bit it would be trivial, as you describe.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login