For example if I have a list of distinct items:
L = [100,55,104,400]
The "relative" orderings can be restated:
R = [1,0,2,3]
I am not sure how to convert L to R. At first I just tried subtracting min(L) from everything but that doesn't "compress" things down to relative order.
I am looking for an efficient solution (not O(n2)).