Hi Jasen,
You wrote to Herman:
JB>I'm not fully satisfied with it, as it will jumble up elements with the
same
JB>key value (this is not noticeable here) , I would prefer it to keep them
n
JB>their original order, I know there's a tweak to do this, I just can't
hink
JB>what it is.
There is no way round this that I know of with quicksort, or Shell sort
and Comb sort. None will maintain existing ordering and so are
unsuitable for multiple key sorts. In those cases using a fast sort
(one of the above) for the first key, followed by an insertion or
selection (but not the selection sort using exchanges posted by Tom and
Herman as a fast bubble sort) sort for subsequent key(s) is probably
best.
George
* SLMR 2.1a * Wastebasket: Something to throw things near.
--- Maximus/2 3.01
---------------
* Origin: DoNoR/2,Woking UK (44-1483-717905) (2:440/4)
|