Page 1 of 1
Posted: Tue Dec 30, 2008 3:14 pm
by freak
Since PB 4.30, SortStructuredList (and SortList) use Mergesort which is a stable sort, so if you first sort all the list by titles and then again by album you will get a list which is sorted by album and each album is sorted by title.
Note that this does not work with Arrays, as SortArray uses Quicksort which is unstable. (ie the sorting of the secondary key would be lost)
Posted: Tue Dec 30, 2008 6:06 pm
by akj
@ freak:
Please add to the Help documentation for SortStructuredList() and SortList() that they are stable sorts.
Is there any chance in the future for the other sort routines to have a stable sort option in addition to the standard method?
Posted: Sun Jan 04, 2009 3:55 pm
by technicorn
@akj
It's not possible to use Mergesort for arrays, because Mergesort can't work in place, that means the array would have to be taken apart and then put back together again.
With lists you can use the already existend link headers of the list to do it.
For more in depth explanation use google and search for "Mergesort wiki"
Posted: Sun Jan 04, 2009 3:59 pm
by Trond
But it's possible to make a stable quicksort.
Posted: Thu Jan 22, 2009 4:47 pm
by Little John
technicorn wrote:It's not possible to use Mergesort for arrays, because Mergesort can't work in place, that means the array would have to be taken apart and then put back together again.
It
is possible to use Mergesort for arrays, of course.
Regards, Little John