What is the process of reordering one list based on the alleged reordering as a result of sorting another list?

I am not interested in any particular algorithm; I just want to know if this one has a common name that I just don't know about.

To be specific, let's say I have X = [42, 0, 99] and Y = ["a", "b", "c"]. What is called when I change the order of Y in the same way as I have to reorder X to make X a sorted list, ending with ["b", "a", "c"]?

What about reordering itself, which is a kind of list, that is, [<2nd>, <1st>, <3rd>] - also has a common name?

It seems that this will be an operation that will have a name that I should know, with its own Wikipedia page and everything else (or an entry in the NIST dictionary of algorithms and data structures: http://xw2k.nist.gov/dads/ ) . I will probably feel like a mannequin when someone answers this.

+3
source share
4 answers

The reordering itself is called permutation (see explanation) .

I don’t know the special term for the situation, but you can say that you are applying a permutation sorting list X to list Y.

Sidenote. , "" , , [3, 1, 2], {1, 2, 3}, ( ), , , [3, 1, 2] [1, 2, 3].

+2

" ". X - , Y.

+1

As far as I know, the term for this specific situation does not exist, but you apply the same transformation to lists X and Y, and you create a transformation so that it converts the list X into a sorted list.

+1
source

You can call it a parallel key, since X contains sort keys and Y contains values. In a functional language, for example, Scala, this can be implemented as X.zip (Y) .sortWith ((a, b) => a._1 <b._1) .map (a => a._2)

+1
source

Source: https://habr.com/ru/post/1790581/


All Articles