For example, if n is 4, binary encoding allocates these codewords:
Number | Encoding |
---|---|
0 | 000 |
1 | 001 |
2 | 010 |
3 | 011 |
4 | 100 |
UNUSED | 101 |
UNUSED | 110 |
UNUSED | 111 |
Instead, truncated binary allocates:
Number | Encoding |
---|---|
0 | 00 |
1 | 01 |
2 | 10 |
3 | 110 |
4 | 111 |
You can think of this as allocating an UNUSED to the first few symbols (until you run out of UNUSEDs), to make the first few symbols' codewords shorter.
Search Encyclopedia
|