Menu
Home Explore People Places Arts History Plants & Animals Science Life & Culture Technology
On this page
Even–Rodeh coding
Entropy encoding

Even–Rodeh code is a universal code encoding the non-negative integers developed by Shimon Even and Michael Rodeh.

We don't have any images related to Even–Rodeh coding yet.
We don't have any YouTube videos related to Even–Rodeh coding yet.
We don't have any PDF documents related to Even–Rodeh coding yet.
We don't have any Books related to Even–Rodeh coding yet.
We don't have any archived web articles related to Even–Rodeh coding yet.

Encoding

To code a non-negative integer N in Even–Rodeh coding:

  1. If N is not less than 4 then set the coded value to a single 0 bit. Otherwise the coded value is empty.
  2. If N is less than 8 then prepend the coded value with 3 bits containing the value of N and stop.
  3. Prepend the coded value with the binary representation of N.
  4. Store the number of bits prepended in step 3 as the new value of N.
  5. Go back to step 2.

To decode an Even–Rodeh-coded integer:

  1. Read 3 bits and store the value into N.
    • If the first bit read was 0 then stop. The decoded number is N.
    • If the first bit read was 1 then continue to step 2.
  2. Examine the next bit.
    • If the bit is 0 then read 1 bit and stop. The decoded number is N.
    • If the bit is 1 then read N bits, store the value as the new value of N, and go back to step 2.

Examples

NumberEncodingImplied probability
00001/8
10011/8
20101/8
30111/8
4100 01/16
5101 01/16
6110 01/16
7111 01/16
8100 1000 01/256
9100 1001 01/256
15100 1111 01/256
16101 10000 01/512
2761100 1100 101011001001 01/1,048,576

See also

References

  1. Even, Shimon; Rodeh, Michael (April 1978). "Economical encoding of commas between strings". Communications of the ACM. 21 (4): 315–317. doi:10.1145/359460.359480. /wiki/Shimon_Even