Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the process of reordering one list based on the implied reordering resulting from sorting another list called?

I'm not interested in any particular algorithm; I just want to know if doing that has a common name that I'm just not aware of.

To be specific, say I have X = [42, 0, 99] and Y = ["a", "b", "c"]. What is it called when I reorder Y in the same way that I have to reorder X to make X a sorted list, winding up with ["b", "a", "c"]?

What about the reordering itself, which is kind of a list - i.e. [<2nd>, <1st>, <3rd>] - does that have a common name too?

It seems like that would be the kind of operation that would have a name that I should know, with its own Wikipedia page and everything (or an entry in the NIST's Dictionary of Algorithms and Data Structures: http://xw2k.nist.gov/dads/). I'm probably going to feel like a dummy when someone answer this.

like image 292
jtolle Avatar asked Dec 08 '25 15:12

jtolle


2 Answers

The reordering itself is called a permutation(see sidenote).

I am not aware of a special term for the situation, but you could say that you're applying the permutation that sorts the list X, to the list Y.

Sidenote: Note that the word "permutation" can refer to both a particular ordering of a group of elements, for instance with the ordered list [3, 1, 2] being a permutation of the numbers {1, 2, 3}, as well as a reordering of elements (as in, the transformation itself), for instance the one that permutes the ordered list [3, 1, 2] to the ordered list [1, 2, 3].

like image 164
Sebastian Paaske Tørholm Avatar answered Dec 11 '25 15:12

Sebastian Paaske Tørholm


I've mostly known it as an "indexed sort". X is the index you use to sort Y.

like image 29
cabbey Avatar answered Dec 11 '25 15:12

cabbey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!