Possible Duplicate:
In-place array reordering?
I have original unsorted array with structures such as:
{D, A, B, E, C}
and array of indexes of original array in sorted order:
{2, 3, 5, 1, 4} // Edited. Then I get {A, B, C, D, E}.
How can I simply rearranged the originial array by an index array?
I can’t create new array and insert elements by index-position.
Here’s a version that works, but note that it does invalidate the
indicesvariable: