Study Vault Search notes, aliases and full text
Graph
ConceptDBISAI-written · not yet proofread

Elias-Gamma Code

The Elias-Gamma code of a positive integer x consists of ⌊log₂ x⌋ zeroes followed by the binary representation of x, and has length 2⌊log₂ x⌋ + 1.

Know these firstPrefix-Free Code

Formula#

L(x)=2⌊log⁡2x⌋+1L(x) = 2 \lfloor \log_2 x \rfloor + 1

Properties#

  • Prefix-free: the number mm of leading zeroes determines that exactly m+1m + 1 bits (the binary number) follow.
  • Cheap for small numbers (1 bit for x=1x = 1), logarithmic in xx; entropy-optimal for Pr⁡(x)≈2−L(x)\Pr(x) \approx 2^{-L(x)}.
  • Elias-Delta encodes the zeroes part itself with Gamma and wins for large xx.

Example#

xxBinaryCodeLength
1111
2100103
3110113
4100001005
7111001115
8100000010007
15111100011117
16100000000100009

Sources#

  • DBIS Exam WS2223 (not published) Task 1.2 (codes for 3, 4, 7, 8, 15, 16 and the length formula)
  • Not lectured in WS 25/26.

Search

Type In
↑ ↓ move ↵ open ⇥ next section Ctrl↵ results page Prefix # to search text only