On 20 Mar 98, Tim Hutzler snarfled at Timo Finnilä and muttered thus:
TF>> Help me please, i got a big problem %-)
TF>> How do i (quick)sort linked lists?
TH> Collect the pointers into an array. Sort the pointers using whatever key
TH> you wish to sort by. Then build a new linked list. ___ Blue Wave/QWK
I would recommend forgetting a quick sort, and just re-build a copy of the
linked list in sorted form. The main nice feature about linked lists is the
ability to insert items with the minimum of fuss.
Even better, sort the list stright away as you add items in. Insert them in
the right place to start with. (That is, if it's appropiate to do so).
--- Spot 1.3a Unregistered
---------------
* Origin: (2:2500/702.25@FidoNet)
|