TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: GEORGE WHITE
from: DAVID NOON
date: 1998-04-06 21:07:00
subject: Insertion Or Bubble?

In a message dated 04-05-98, George White said to David Noon about Insertion
Or Bubble?
Hi George,
GW>You should have! Richard has it on DoNoR/2 so you have no excuse... :-)
Ok, I'll download a copy of SNIPPETS tomorrow night.
GW>Some of the code in there is interesting in it's alternative approaches.
GW>The generic qsort() routine maintains an internal stack to control
GW>recursion, which is much faster than true recursion as it only involves
GW>storing two variables and updateing the stack offset (pointer) variable
GW>rather than the full overhead of a function call.
You are getting a little ahead of the code I am posting in C_PlusPlus here.
I was going to post the non-recursive Quickersort after I had posted the
median-of-three version.
GW>There are, inevitably, some lapses from optimum codeing practise. eg the
GW>specialised version of quicksort for int data calls an external routine
GW>to swap elements.
Rather nasty, calling a subroutine to perform 3 machine instructions.
GW>By declaring the transfer temporary variable in the
GW>main sort routine and using a macro for the swap the clarity of code
GW>presentation can be maintained while achieving a measureable improvement
GW>in sort speed.
Macros! I hate safe code too. ... :-)
Regards
Dave

___
 * MR/2 2.25 #353 * In plumbing, a straight flush is better than a full house
--- 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™.