1:34 PM
@NordineLotfi I think you're clear enough grammatically. Unfortunately, your last remark is indeed the case; you are trivially wrong because the 8-to-1 packing is already optimal so obviously nothing can do better than it. At this point I think the best for you is to simply learn the (simple) mathematics needed to prove it to yourself.
If your input has n characters, there are 2^n possible combinations of positions that you may wish to encode. So trivially you need to use an encoding that has 2^n possible combinations, and thus no encoding can use less than n bits = n/8 bytes. Since the 8-to-1 packing that I stated achieves that, it is optimal.
4 hours later…
5:35 PM
@user21820 um, i did said "i might be wrong in stating that it could give me better space saving than the method i mentioned/you corrected me on, but I just like to experiment for myself even if I end up wrong"
@NordineLotfi Since you said "might be wrong", that's why I corrected you by telling you "definitely wrong". I don't waste people's time, so I don't help people to learn something that I already know is a waste of time. You're of course free to waste your own time, but as I said you're better off first learning the trivial mathematics and programming the optimal solution before you even bother with other things.
« first day (3747 days earlier) ← previous day next day → last day (1204 days later) »