Been looking for some examples of various sort routines. Hard to find them in QBASIC dialects. That'll be useful. Thanks for posting.
I'm just curious:  Do you guys ever search the forums for anything you might be interested in??
https://qb64forum.alephc.xyz/index.php?topic=530.msg5451#msg5451'Date tested O()     Algorithm name                                                                 time(ms)  in-place  deployment special notes
'2018-Mar-13 N       FlashSort (CGSortLibArr() AS DOUBLE, start AS LONG, finish AS LONG, order&)         117  N         requires inversion for descending order 
'2018 Mar 13 NLogN   QuickSortRecursive (CGSortLibArr() AS DOUBLE, start&, finish&, order&)              148  Y         Requires CPU stack, uses middle array element for
'                                                                                                                       partitioning step. 
'2018 Mar 13 NLogN   QSortRecursiveSimplified (CGSortLibArr() AS DOUBLE, start&, finish&)                160  Y         Requires CPU stack 
'2018nMar 13 NLogN   QuickSortIterativeMedianOf3 (CGSortLibArr() AS DOUBLE, Start&, Finish&, order&)     161  Y         Uses software-based stack, Median of Three
'                                                                                                                       Partitioning strategy used to defeat "QuickSort
'                                                                                                                       Killer" array arrangements for QuickSort algorithms
'                                                                                                                       using the middle element as the sole pivot chice.
'                                                                                                                       Remember, DDoS attacks using this flaw in Java? 
'2018 Mar 13 NLogN   QuickSortIterative (CGSortLibArr() AS DOUBLE, Start&, Finish&, order&)              164  Y         Uses software-based stack, handy for old CPUs that do
'                                                                                                                       not support recursive stacks in hardware. Or just to
'                                                                                                                       implement for certainty where hardware or virtualization
'                                                                                                                       is not guaranteed to support hardware stacks.
' 
'2018 Mar 13 N       HashListSort (CGSortLibArr() AS DOUBLE, start AS LONG, Finish AS LONG, order&)      171  N         Can be implemented without CGSortLibArr() with mods
'                                                                                                                       With the data type and range in this original demo
'                                                                                                                       HashListSort actually BEATS FlashSort by at least
'                                                                                                                       an 11% margin. Don't let this fool you. This is the
'                                                                                                                       result of a SINGLE run, and generalizing on a single
'                                                                                                                       run is not a good idea, which is why I assembled a
'                                                                                                                       test harness using multiple passes and ascending,
'                                                                                                                       descending order. 
'2018 Mar 13 NLogN   IntroSort (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                       226  N         uses MergeSort, HeapSort, InsertionSort and performs
'                                                                                                                       comparably and favorably to non-hybrid QuickSort,
'                                                                                                                       usually within a few percent or less. 
'2018 Mar 13 NLogN   QuickSortDualPivot (CGSortLibArr() AS DOUBLE, start&, finish&, order&)              244  Y         Not bulletproof but works for most cases of highly
'                                                                                                                       repetitive data fails for low-repetition data. 
'2018 Mar 13 NLongN  SnakeSort (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                       250  N         Auxiliary memory is O(N). Also a very nice-performing
'                                                                                                                       algorithm. Not the fastest (yes, compared to HashListSort
'                                                                                                                       with 70ms @ (0, 131071) elements, not even FlashSort can
'                                                                                                                       keep up. 
'2018 Mar 13 NLogN   MergeSort (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                       257  N         Auxiliary memory is O(N/2) when used with
'                                                                                                                       EfficientMerge 
'2018 Mar 13 NLogN   MergeSortTwoWay (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                 287  N         Good for memory-constrained systems 
'2018 Mar 13 N       RadixSort (a() AS DOUBLE, start&, finish&, order&)                                  296  N         Only for integers, otherwise it will use MergeSort
'                                                                                                                       to maintain RadixSort's stability 
'2018 Mar 14         BucketSort (CGSortLibArr() AS DOUBLE, start&, finish&, order&, recurse%)            280  N         Without recursion, 100 times slower 20812ns
'                                                                                                                       Final subarray sort done with MergeSort keeps this
'                                                                                                                       algorithm competitive. 
'2018 Mar 13         SinglePassShellSort (CGSortLibArr() AS DOUBLE, start&, finish&, order&)             335  Y         Got this idea from reading LOTS of articles. Performs
'                                                                                                                       respectably. 
'2018 Mar 13         PrimeGapSort2 (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                   343  Y         Invented by CodeGuy/Zom-B, uses wheel factorization
'                                                                                                                       to generate primes. 
'2018 Mar 13         PostSort (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                        351  N         Large auxiliary overhead. Final sort of subarrays
'                                                                                                                       done with MergeSort also keeps this algorithm competitive
'                                                                                                                       Like BucketSort, except that it uses a fixed number of
'                                                                                                                       buckets. Using fewwer actually increases speed, at 1
'                                                                                                                       Bucket, it's essentially a MergeSort. 
'2018 Mar 13         PrimeGapSort (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                    382  Y         Invented by CodeGuy. Proud to declare PrimeGapSort
'                                                                                                                       is competitive and performs on par with ShellSort or
'                                                                                                                       better. Uses gaps that are prime. 
'2018 Mar 13         JoinSort (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                        484  N         A respectably quick algorithm. Also, not the fastest
'                                                                                                                       but for a comparison sort, good enough. 
'2018 Mar 13 NLogN   HeapSort (CGSortLibArr() AS DOUBLE, Start&, Finish&, order&)                        492  Y 
'2018 Mar 13         ShellSortMetzner (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                500  Y         With this variant, it is appreciably faster than ShellSort. 
'2018-Mar-13         ShellSort (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                       546  Y 
'2018 Mar 13         CombSort (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                        898  Y 
'2018 Mar 13 Nlog^2N BatcherOddEvenMergeSort (CGSortLibArr() AS DOUBLE, Start&, Finish&)                1093  Y         Only works for power-of-2 sized arrays 
'2018 Mar 13         SmoothSort (TypedCGSortLibArr() AS DataElement, order&)                            1292  Y         requires use of TYPE array) and only 0 to ubound.
'                                                                                                                       no ranges
'2018-Mar 13         ShellSortBidirectional (CGSortLibArr() AS DOUBLE, start&, finish&, order&)         2421  Y 
'2018 Mar 13         BitonicSort (CGSortLibArr() AS DOUBLE, lo&, n&, dir&)                              2609  Y 
'2018-Mar-13 N^2     InsertionSort (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                229133  Y         Very fast for nearly-sorted arrays. Used as finishing
'                                                                                                                       run for many ShellSort variations. 
'2018 Mar 13 N^2     InsertionSortBinary (CGSortLibArr() AS DOUBLE, start&, finish&, order&)          330328  Y         Supposedly faster than InsertionSort. Using randomized
'                                                                                                                       Double-precision, generally non-repeating, not proven
'                                                                                                                       in practice. 
'2018 Mar 13 N^2     CycleSort (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                    784852  Y 
'            N^2     bubblesort (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                      ------
'            N^2     CocktailSort (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                    ------
'            N^2     SelectionSort (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                   ------
'            N^2     InsertionSortx (CGSortLibArr() AS DOUBLE, start&, finish&, order&)                  ------
'                    FlashSORTType (CGSortLibArr() AS FlashRec, start AS LONG, finish AS LONG, order&)   ------ as yet untested. An experimental algorithm for use with
'                                                                                                       string-type variables 
'* InsertionSort(), BubbleSort(), MergeSort() are considered stable. The remainder either are not or as yet unconfirmed
'* I ran these individually and corrected flaws. Sorts that have times have been tested in ascending/descending order
'* this is a work in progress. The algorithms marked by ------ are too slow to be practical for this demo code
'* Tested on double-precision data.