home *** CD-ROM | disk | FTP | other *** search
- Path: haapa.oulu.fi!not-for-mail
- From: tikarjal@haapa.oulu.fi (Timo Karjalainen)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Sorting a list
- Date: 7 Apr 1996 09:39:00 GMT
- Organization: University of Oulu
- Distribution: 'Net
- Message-ID: <4k82fk$f5s@ousrvr3.oulu.fi>
- References: <272.6650T63T1340@sn.no> <ZZNYYD.96Mar21121908@diku.dk> <xUqu7MD1A7alz7@0dietmar.tomate.tng.oche.de>
- NNTP-Posting-Host: haapa.oulu.fi
- Mime-Version: 1.0
- Content-Type: text/plain; charset=iso-8859-1
- Content-Transfer-Encoding: 8bit
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- Dietmar Eilert (DIETMAR@TOMATE.TNG.OCHE.DE) wrote:
-
- : You could use a simple modification of bubble sort to boost performance to
- : the speed of QuickSort: use a dynamic interval instead of comparing
- : neighbours only.
-
- Another speedup would be to alternate walking through the items from head
- to tail and vice versa. The worst caveat of bubblesort is that items that
- would belong to the head but are at the tail only move one position at a
- time towards the head of the list - if the list is only processed from
- head to tail, and vice versa if it's done tail to head. By alternating
- both ways, the worst-case items should swim into their correct positions
- somewhat faster.
-
- The termination test is as usual: when either of the sort loops ends without
- any swaps, the list is ordered.
-
- tikarjal
-
-