|
String Sort Routines: Quick, Merge, Selection, and Insert Sort
| Version Compatibility: |
Visual Basic 5 Visual Basic 6
|
More information: Generic string sort routines. I prefer to use the 'non-pure' Quick Sort unless you have a good reason to choose another routine.
Here are the routines in order of efficiency.
- Quick Sort: Fast for large arrays - delegates to insert sort when called with a small array and to sort small chunks of the large array. This 'non-pure' quick sort is therefore quicker by not recursing for small chunks where a simple brute-force iteration is quicker.
- Merge Sort: Fast for large arrays - larger memory footprint than QuickSort. Delegates to insert sort for small arrays.
- Insert Sort: Fast for small arrays (say less than 60 values)
- Selection Sort: Fast for small arrays (say less than 60 values)
NOTE: Due to the recursive nature of Quick and Merge sort they are not very efficient for small arrays which is why the routines delegate to a more brute force insert sort for small arrays.
This code has been viewed 103999 times. Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents. code/stringsort.zip
|