Posted: Tue Aug 16, 2005 2:58 pm Post subject: (No subject)
It's actually a pretty straightforward problem, just look at the output for the examples. The result is the length of the compressed string. So instead of having BARXFOO you would have *2X*1 because *2 is BAR and *1 is FOO. "*2X*1" is 5 characters so that is what you would get as a result (as opposed to 7 characters without the compression).
Sponsor Sponsor
wtd
Posted: Tue Aug 16, 2005 3:37 pm Post subject: (No subject)
Of course, in reality, you have to add 6 characters to communicate what the keys are.
[Gandalf]
Posted: Tue Aug 16, 2005 3:44 pm Post subject: (No subject)
Yes, so it's only really a compression technique if there are more than one of the 'keys' in the string. You could also add detection for that, so that you don't make some file bigger instead of smaller .
bugzpodder
Posted: Tue Aug 16, 2005 6:17 pm Post subject: (No subject)
[Gandalf] wrote:
It's actually a pretty straightforward problem, just look at the output for the examples. The result is the length of the compressed string. So instead of having BARXFOO you would have *2X*1 because *2 is BAR and *1 is FOO. "*2X*1" is 5 characters so that is what you would get as a result (as opposed to 7 characters without the compression).
the more interesting case is when keys overlap.
such as for keys AAA and AAB
wtd
Posted: Tue Aug 16, 2005 7:46 pm Post subject: (No subject)
bugzpodder wrote:
[Gandalf] wrote:
It's actually a pretty straightforward problem, just look at the output for the examples. The result is the length of the compressed string. So instead of having BARXFOO you would have *2X*1 because *2 is BAR and *1 is FOO. "*2X*1" is 5 characters so that is what you would get as a result (as opposed to 7 characters without the compression).
the more interesting case is when keys overlap.
such as for keys AAA and AAB
Yes, since "compressing" based on the first key inherently changes the result of "compressing" using the second key.
[Gandalf]
Posted: Tue Aug 16, 2005 10:10 pm Post subject: (No subject)
Hmm, ya I see. What I would do though is just replace the first key, and then you have nothing to worry about since the overlap doesn't exist anymore . Yes, me and my lazy ways...