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

Hi David,
You wrote to me:
DN>GW>I hope no one notices the only C++ isms were some embedded declarations
DN>GW>:-)
DN>Yes, I was expecting a polymorphic template from a C++ mavin like 
nathan.
Me too...
DN>GW>And also in SNIPPETS :-)
DN>I don't have a copy of SNIPPETS. But for good sorting, I don't need it, as
DN>we have seen. ... :-)
You should have! Richard has it on DoNoR/2 so you have no excuse... :-)
Some of the code in there is interesting in it's alternative approaches.
The generic qsort() routine maintains an internal stack to control
recursion, which is much faster than true recursion as it only involves
storing two variables and updateing the stack offset (pointer) variable
rather than the full overhead of a function call.
There are, inevitably, some lapses from optimum codeing practise. eg the
specialised version of quicksort for int data calls an external routine
to swap elements. By declaring the transfer temporary variable in the
main sort routine and using a macro for the swap the clarity of code
presentation can be maintained while achieving a measureable improvement
in sort speed.
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™.