TIP: Click on subject to list as thread! ANSI
echo: locuser
to: Keith Richardson
from: Peter Nielsen
date: 1995-08-17 20:09:02
subject: Sort of sorting...

On 15 Aug 95  14:47:31 Keith Richardson typed to Peter Nielsen about Sort
of sorting...

 > i did something like this when i did a fortran course once, and we had
 > to write a bubble sort as an exercise. it gives a dramatic increase in
 > speed.

As i discovered about 10 years ago.


 >  PN> 8135 IF CS=0 GOTO 8197     If no swap occured then sort is complete.

 > you can also get a further increase in speed if, instead of just using a
 > simple binary flag, you save the index of the current swap. you then use
 > this as the loop limit in the next pass as anything in the list beyond
 > the last swap must already be in order.


Good one. I hadn't thought of that.  Thanks

 > of course its all rather futile, as the only good thing about a bubble
 > sort is that it is easy to understand. it will never be fast no matter
 > what you do, unless you are sorting very short lists where the set up
 > time for the more complex and efficient sort techniques become
 > significant.

Yep. As I said to Bob, I have only had to deal with less than 100 records,
so i have never had the need to look for anything faster.

Cheers
Peter Nielsen

--- FMail/386 0.98
* Origin: Pointing South * Tasmania * Australia * (3:670/213.232)
SEEN-BY: 711/934
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

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™.