From your problem statement, you have not only just ASCII characters but only upper case ASCII, not binary data.
I would go "old school" and use the
Baudot_code. This gets each 8 bit byte to 5 bits. Shifting between upper and lower case can be done but requires an additional "control" character.
The advantage of this is that this is a well known standard that is still in use today. There is nothing tricky or fancy about this. That means that it can be done very efficiently. 8 bits -> 5 bits according to a standard protocol.
Update: That means that 3 of every 8 bits are not needed. 3/8 means, 37.5% compression for almost nothing.
Also if this is true: "One can assume a random distribution of characters from Alphabet A = {A, B, C}". There is not much that you can do past baudot code. Random data cannot be compressed. Oh, I perhaps see now, the alphabet will be limited to a set less than 26 characters. In that case, perhaps make your own version of the Baudot code? Perhaps send a block of translation tables before the actual data? It does appear to me that you can achieve a huge amount of compression with a table driven, very efficient algorithm.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.