Article View: comp.lang.modula2
Article #252Re: Sorts
From: Tim Larson
Date: Tue, 12 Sep 1989 11:42
Date: Tue, 12 Sep 1989 11:42
20 lines
1485 bytes
1485 bytes
In article <INFO-M2%89091120313809@UCF1VM>, BOTCHAIR@UOGUELPH.BITNET (Alex Bewley) says: > > Bubble sort is a little bit too slow for my application. I need to sort > a linked list in memory. The algorithm I want must not use or > require a FIXED array to sort, as the list is dynamic. Still not quite enough information to tell, but you may not need to sort at all if it's a linked list! That is, as you load each element in the list, simply link it in in-order. When the last element is added, the list is sorted already. I used this technique once in school, when a grade depended on it (we were graded partially on how fast our program was in comparison to the rest of the class). In that case, my program outperformed all the programs that performed sorts. If the list is long, and you can afford a bit more space, this can be made more efficient by using two links and a tree structure. I don't know if this applies to your situation, but maybe there is a germ of an idea you can use here. -Tim Larson odx@psuvm.bitnet
Technical Details
Message-ID:
<89255.074225ODX@PSUVM.BITNET>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!aplcen!ginosko!usc!brutus.cs.uiuc.edu!psuvax1!psuvm!odxReferences:
<heilpern@VAX1.ACS.UDEL.EDU> <INFO-M2%89091120313809@UCF1VM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!aplcen!ginosko!usc!brutus.cs.uiuc.edu!psuvax1!psuvm!odx From: ODX@PSUVM.BITNET (Tim Larson) Newsgroups: comp.lang.modula2 Subject: Re: Sorts Message-ID: <89255.074225ODX@PSUVM.BITNET> Date: 12 Sep 89 11:42:25 GMT References: <heilpern@VAX1.ACS.UDEL.EDU> <INFO-M2%89091120313809@UCF1VM> Organization: Penn State University Lines: 20