Sorting an array along with its indices
Often, it is required to sort an array along with its indices. For example, if an array contains a = [3, 1, 2] then its indices are i = [0, 1, 2]. When the array is sorted as b = [1, 2, 3], then the corresponding indices should also get rearranged as j = [1…