I already know the sorted positions, so I want to sort based on that.
Say, I have list of {1, 3}
, I want the sorted position to be {2, 1}
, as 2 is the second element, 3 and 1 is the first element 1.
How should I write the sort function to be most simple.
Should I write something like Sort[{1, 3}, {2, 1}{{_}}]
where _
should represent the indice of that element in the original list.
{1,3}[[{2,1}]]
? More generally,list[[Ordering[list]]]
$\endgroup$