Suppose we have two arrays:
a = [4,3,8,7]
b = [(1,2),(5,6),(8,6),(9,0)]
So what we want is to sort the array a. So the sort result should be a_sorted = [3,4,7,8]. And we should not sort array b. Instead, the order of array b should be changed according to the sort order of array a.
So array b should be b_sorted = [(5,6),(1,2),(9,0),(8,6)]
ie, the order of a_sorted will be a_sorted = [a[1],a[0],a[3],a[2]]. Respectively,b_sorted = [b[1],b[0],b[3],b[2]]
The question is simpler. Is there a name for this sort of sorting ?: