تدرّب على الرياضيات المنفصلة

Algorithms / Coordinate Compression

Least You Need to Know: Coordinate Compression, Order Preservation, and Dense Indexing

Coordinate compression replaces sparse or huge values with a dense rank order while preserving **relative order comparisons**. It is a preprocessing bridge between messy input values and array-based data structures.

The least you need to know

Key notation

rank(x) compressed index assigned to value x
sorted distinct values basis for the compression mapping
dense index small contiguous integer index set

Tiny worked example

  • Suppose relevant x-values are `10, 1_000_000, 17, 10`.
  • The sorted distinct values are `10, 17, 1_000_000`.
  • A compression map might send them to `1, 2, 3`.
  • Order comparisons still work, and array-based structures become practical.

Common mistakes

How to recognize this kind of problem

Start practice