TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: DAVID NOON
from: GEORGE WHITE
date: 1998-04-02 19:45:00
subject: Select, Insert, Bubble!

Hi David,
DN>Insertion sort is _always_ at least as fast as bubble sort, and 99.999% of
DN>the time it is faster. The larger the array size the more favourable for
DN>Insertion sort it becomes.
DN>However, for larger arrays both bubble sort and Insertion sort should be
DN>left behind. We then move into the area where serious sorting algorithms 
are
DN>required, starting with Shellsort. [Or Combsort, if you prefer.]
I've put together a C test harness for timing sorts, and while I allow
the better sorts (quickersort, shellsort, Jonathans Combsort) to sort
any settable size of array (a max char limit of 14000, as I'm using BC
3.1 and I wanted all data in the near heap), I limited timings of
insertion sorts to 500 elements because they took _far_ too long to run
with more. I've run it with the sorts from SNIPPETS, Jonathan's Combsort
(with some declarations moved to make it C) and your insertion sort.
Sorting the same data set shellsort is always faster than Jonathan's
Combsort.
George
 * SLMR 2.1a * Wastebasket: Something to throw things near.
--- Maximus/2 3.01
---------------
* Origin: DoNoR/2,Woking UK (44-1483-717905) (2:440/4)

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