3 ms·
> got the number 1024, I had a problem. Space could be saved if coffee was 1. Sounds like OP is encoding as ascii encoded digits? Seems like there should be s
by jrochkind1 3y ago
> got the number 1024, I had a problem. Space could be saved if coffee was 1.
Sounds like OP is encoding as ascii encoded digits? Seems like there should be space to be saved there by encoding as actual numeric bytes instead, although of course since you will need more than 256 numbers, you'll have to have an encoding for variable-width numbers similar to what UTF-8 does. Or if you don't need more than 65K, maybe just two-byte-width numbers would still save you significant space over ascii digits (where anything over 9 is already two bytes!)
I don't entirely understand the exersize. Like, if the size of the compressing software and data (such as the dictionary) are taken into account too. And it seems unlikely this kind of naive reinventing the wheel approach is going to beat, say, gzip in the first place? (or am I really wrong there?)
But it is fun and educational to invent new DIY compressions!