TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: GEORGE WHITE
from: HERMAN SCHONFELD
date: 1998-04-13 09:36:00
subject: Best sort algorithm [1/4

HS> 1) With an already sorted list fast bubble sorts executes fastest
GW>But with a nearly sorted list I would expect insertion sort to be
GW>fastest (what is the point of running a sort routine against data one
GW>already knows is ordered?)
Not necessarily completely sorted. If you have minor disordered elements then 
bubble sort would be the fastest.
GW>You have used the classic Quicksort with an internal stack (and an
GW>enormous one at that!), but without putting the _largest_ of the two
GW>partitions on the stack (which the classic algorithm specifies). If the
GW>largest partition is put on the stack Quicksort has a stack use of
GW>lg(N+1)/(M+2), where N is the number of elements and M is the length of
GW>the arrays when recursion is stopped and another sort (usually
GW>insertion) used for the final phase.
GW>A stack 100 deep will allow sorting of arrays of up to around 10**43!!!
GW>With a 20 deep stack the limit is around 10**8.
GW>This makes the memory use of quicksort much more reasonable.
GW>Have you investigated the Quickersort variation: useing insertion
GW>sort when the partition to be sorted is less than a set number of
GW>elements (7 is a typical value), and also Singletons method of selecting
GW>the key as the median of the left, right, and centre values of the
GW>partition.
No I haven't. Post some code.
... Include this in your CONFIG.SYS File: BUGS=OFF.
--- Ezycom V1.48g0 01fd016b
---------------
* Origin: Fox's Lair BBS Bris Aus +61-7-38033908 V34+ Node 2 (3:640/238)

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