Gap Encoding
Gap encoding stores a sorted list as its first element followed by the differences between consecutive elements, which are small numbers that a variable-length integer code compresses well.
Know these firstInverted Index
Properties#
- Particularly effective for the sorted inverted lists (List Intersection needs them sorted): the more frequent a word, the denser its list and the smaller the gaps, so few bits per posting.
- Lists must be decoded sequentially (prefix sums) to reach an element.
Example#
becomes (DBIS Exam WS1314 (not published), Task 1.1). For the entropy-optimal code of the gaps (two values with probability each, lengths 1 bit) see Entropy-Optimal Code.
Sources#
- DBIS Exam WS1314 (not published) Task 1
- Not lectured in WS 25/26 (DBIS_VL13 > Work at the Chair announces compression for the advanced course).