I have an indexed of of objects:
indexArray = [
{obj 1},
{obj 2},
...
{obj n}
];
I apply a sorting algorithm to it and the indexArray ends up being mixed up:
indexArray = [
{obj 77},
{obj 36},
...
{obj 8}
];
If there was one element in the original array whose before and after Index I want to keep track of. For example, obj 36 was at index[35] before sorting, and the new index is index[1]. How would I determine the new index.
Could I hold on to the element/obj36 in a temp variable before the sort, and then after the sort, ask indexArray the current index of obj36? And if so, how?