For instance, Heap-Sort Algorithm is unstable or Quick Sort depends on the Implementation for stability. This stability must only be provided with O(n) additional memory, not the other strategies.
I have tried this question for the whole day, but I couldn't. Please Help!....
If you want to do a stable sort of a range
Ausing an unstable sorting algorithm, you can:Bsuch thatB[i] = (A[i], i);Bwith the comparison functionB[i] < B[j] if (A[i] < A[j] or (A[i] == A[j] and i < j));Bback intoAby just removing the second part (thei).