Search code examples
algorithmlistsortingnaming

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.


Solution

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