TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: TIM HUTZLER
from: BILL GODFREY
date: 1998-03-26 23:29:00
subject: Sorting linked list

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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.