3 ms·
OP's code still only has log2(52!) different binary strings that can be encoded, but they vary in length from 52 to 1378 bits (and are the leaves of a binary tr
by snarkconjecture 3y ago
OP's code still only has log2(52!) different binary strings that can be encoded, but they vary in length from 52 to 1378 bits (and are the leaves of a binary tree). This is handy for easily encoding sequences drawn from a non-uniform distribution, like strings of English letters, by giving each letter a fixed-length binary codeword. It's sort of flipped from the more common method of giving symbols a varying-length binary codeword (e.g. with Huffman coding) and encoding a fixed-length binary string in a deck of cards (or anything else).