sort arrays but keeping track of the location

Questions about MultiCharts and user contributed studies.
turbofib
Posts: 213
Joined: 11 May 2013
Has thanked: 67 times
Been thanked: 1 time

sort arrays but keeping track of the location

Postby turbofib » 19 Apr 2020

hi,
an example to clarify it:

a=[5 1 8 2 5 2]

solved:

b=[1 2 2 5 5 8] ==> array sort

c=[2 4 6 1 5 3] ===> position element

how can I get the array position's as fast as possible? (i avoid to use loop)

i can use array_sort but it not keep track of position

turbofib
Posts: 213
Joined: 11 May 2013
Has thanked: 67 times
Been thanked: 1 time

Re: sort arrays but keeping track of the location

Postby turbofib » 21 Apr 2020

hi,

Is there someone who can help me?

User avatar
rrams
Posts: 128
Joined: 10 Feb 2011
Location: USA
Has thanked: 7 times
Been thanked: 70 times
Contact:

Re: sort arrays but keeping track of the location

Postby rrams » 21 Apr 2020

I encourage you to try writing your own 2 dimensional sort routine.
Maybe this can help you: https://www.usingeasylanguage.com/sksort/


Return to “MultiCharts”