Normal
A context-independent solution to stabilize quicksort (and other unstable sort algo's) is, before performing the sort operation, adding an extra column and fill it with a sequential number sequence (which would represent the current order of appearance of all rows), then do the qsort/whatever, where the sort criterium now includes that extra sequence column as the least significant key part.In short: do not sort on (column) but on (column, seqid).That way you don't have to 'remember' anything and it has perceived unlimited recall as any previous operations are all represented together through the temporary sequential number column.This is a generic approach for when you don't know whether the sort code in use (a library call, mostly) is a stable or unstable algorithm.
A context-independent solution to stabilize quicksort (and other unstable sort algo's) is, before performing the sort operation, adding an extra column and fill it with a sequential number sequence (which would represent the current order of appearance of all rows), then do the qsort/whatever, where the sort criterium now includes that extra sequence column as the least significant key part.
In short: do not sort on (column) but on (column, seqid).
That way you don't have to 'remember' anything and it has perceived unlimited recall as any previous operations are all represented together through the temporary sequential number column.
This is a generic approach for when you don't know whether the sort code in use (a library call, mostly) is a stable or unstable algorithm.