ڈسکریٹ میتھ کی مشق

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.

جو کم از کم جاننا ضروری ہے

اہم علامتیں

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

مختصر حل شدہ مثال

  • 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.

عام غلطیاں

اس قسم کے سوال کو کیسے پہچانیں

مشق شروع کریں