arrayscomplexitysorting
Shrink large values without losing their order
Anonymous
Coordinate compression maps sorted distinct values to ranks 0, 1, 2, and so on. Comparisons keep the same order, while array-based structures need space based on the number of distinct values rather than the original value range. Sorting costs O(n log n); building the value-to-rank map is O(n) expected with a hash map.
0