I need to sort an array of strings BUT need to keep a record of the original position of the string from the original array. ALSO store its position in another array (of integers).
e.g.
original array
of strings
0 B
1 B
2 A
3 C
4 F
5 G
6 D
sorted array new array
0 A 0 2
1 B 1 0
2 B 2 1
3 C 3 3
4 D 4 6
5 F 5 4
6 G 6 5
So the result is the original array (but sorted) and another array that contains the position of the original strings in the original unsorted array.
Can anyone help?
Thanks.
e.g.
original array
of strings
0 B
1 B
2 A
3 C
4 F
5 G
6 D
sorted array new array
0 A 0 2
1 B 1 0
2 B 2 1
3 C 3 3
4 D 4 6
5 F 5 4
6 G 6 5
So the result is the original array (but sorted) and another array that contains the position of the original strings in the original unsorted array.
Can anyone help?
Thanks.