Methods for sorting have been intensively studied and optimized. Nevertheless, many poor algorithms (or poor versions of good algorithms) are still in circulation. VB2TheMax's friend David B. Ring have translated a variety of sorting routines into Visual Basic and compared their performance. The collection includes some of the faster algorithms known (e.g., QuickSort, RadixSort and Merge-Sort) and incorporates many optimizations known to increase speed and/or consistency. In this article he discusses and compares the various sorting methods, and provides code to use them in your own applications.
by David B. Ring
January 13, 2003
ethods for sorting have been intensively
studied and optimized. Nevertheless, many poor algorithms (or poor versions
of good algorithms) are still in circulation. Recently, I have translated a
variety of sorting routines into Visual Basic and compared their performance.
The collection includes some of the faster algorithms known (e.g., QuickSort,
RadixSort and Merge-Sort) and incorporates many optimizations known to increase
speed and/or consistency. On an 800 mhz PowerBook running the VBA routines
in Excel 2001, I observe sorting speeds as high as a million random strings
or doubles per minute (Table 1). I hope you will find the code for these sorts
useful and interesting.
What makes a good sorting algorithm?
Speed is probably the top consideration, but other factors of interest include
versatility in handling various data types, consistency of perform-ance, memory
requirements, length and complexity of code, and the property of stability (preserving
the original order of records that have equal keys). As you may guess, no single
sort is the winner in all categories simultaneously (Table 2).
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!