Author Topic: CodeGuuy TESTED/DEBUGGED Sort Library with sample test code  (Read 5230 times)

0 Members and 1 Guest are viewing this topic.


Offline codeguy

  • Forum Regular
  • Posts: 174
    • View Profile
Re: CodeGuuy TESTED/DEBUGGED Sort Library with sample test code
« Reply #1 on: March 14, 2018, 06:57:04 am »
Further testing/verifiication  of correctness. One by one until all anomalies were hunted  down and corrected. Includes results of a single run on every tested algorithm. Some completely refactored.

'* all tested and verified are indicated by a date stamp
'* tested/verified

'*******************************************************************************************************************************************************************
'Date tested O()     Algorithm name                                                                    in-place  deployment special notes
'2018-Mar-13 N       FlashSort (Array() AS DOUBLE, start AS LONG, finish AS LONG, order&)         117  N         requires inversion for descending order

'2018 Mar 13 NLogN   QuickSortRecursive (Array() AS DOUBLE, start&, finish&, order&)              148  Y         Requires CPU stack

'2018 Mar 13 NLogN   QSortRecursiveSimplified (array() AS DOUBLE, start&, finish&)                160  Y         Requires CPU stack

'2018nMar 13 NLogN   QuickSortIterativeMedianOf3 (Array() AS DOUBLE, Start&, Finish&, order&)     161  Y         Uses software-based stack

'2018 Mar 13 NLogN   QuickSortIterative (Array() AS DOUBLE, Start&, Finish&, order&)              164  Y         Uses software-based stack

'2018 Mar 13 N       HashListSort (array() AS DOUBLE, start AS LONG, Finish AS LONG, order&)      171  N         Can be implemented without array() with mods
'
'2018 Mar 13 NLogN   IntroSort (Array() AS DOUBLE, start&, finish&, order&)                       226  N         uses MergeSort, HeapSort, InsertionSort

'2018 Mar 13 NLogN   QuickSortDualPivot (Array() AS DOUBLE, start&, finish&, order&)              244  Y         Not bulletproof but works for most cases of highly
'                                                                                                                repetitive data

'2018 Mar 13         SnakeSort (Array() AS DOUBLE, start&, finish&, order&)                       250  N         Auxiliary memory is O(N)

'2018 Mar 13 NLogN   MergeSort (Array() AS DOUBLE, start&, finish&, order&)                       257  N         Auxiliary memory is O(N/2) when used with
'                                                                                                                EfficientMerge

'2018 Mar 13 NLogN   MergeSortTwoWay (Array() 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 13         SinglePassShellSort (array() AS DOUBLE, start&, finish&, order&)             335  Y

'2018 Mar 13         PrimeGapSort2 (Array() AS DOUBLE, start&, finish&, order&)                   343  Y         Invented by CodeGuy/Zom-B

'2018 Mar 13         PostSort (array() AS DOUBLE, start&, finish&, order&)                        351  N         Large auxiliary overhead

'2018 Mar 13         PrimeGapSort (array() AS DOUBLE, start&, finish&, order&)                    382  Y         Invented by CodeGuy

'2018 Mar 13         JoinSort (Array() AS DOUBLE, start&, finish&, order&)                        484  N

'2018 Mar 13 NLogN   HeapSort (Array() AS DOUBLE, Start&, Finish&, order&)                        492  Y

'2018 Mar 13         ShellSortMetzler (array() AS DOUBLE, start&, finish&, order&)                500  Y

'2018-Mar-13         ShellSort (Array() AS DOUBLE, start&, finish&, order&)                       546  Y

'2018 Mar 13         CombSort (Array() AS DOUBLE, start&, finish&, order&)                        898  Y

'2018 Mar 13 Nlog^2N BatcherOddEvenMergeSort (Array() AS DOUBLE, Start&, Finish&)                1093  Y         Only works for power-of-2 sized arrays

'2018 Mar 13         SmoothSort (TypedArray() AS DataElement, order&)                            1292  Y         requires use of TYPE array) and only 0 to ubound.
'                                                                                                                no ranges
'2018-Mar 13         ShellSortBidirectional (Array() AS DOUBLE, start&, finish&, order&)         2421  Y

'2018 Mar 13         BitonicSort (array() AS DOUBLE, lo&, n&, dir&)                              2609  Y

'2018 Mar 13         BucketSort (Array() AS DOUBLE, start&, finish&, order&)                    20812  N

'2018-Mar-13 N^2     InsertionSort (Array() 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 (Array() AS DOUBLE, start&, finish&, order&)          330328  Y

'2018 Mar 13 N^2     CycleSort (array() AS DOUBLE, start&, finish&, order&)                    784852  Y

'            N^2     bubblesort (Array() AS DOUBLE, start&, finish&, order&)                      ------
'            N^2     CocktailSort (Array() AS DOUBLE, start&, finish&, order&)                    ------
'            N^2     SelectionSort (array() AS DOUBLE, start&, finish&, order&)                   ------
'            N^2     InsertionSortx (Array() AS DOUBLE, start&, finish&, order&)                  ------
'                    FlashSORTType (Array() 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.
'*******************************************************************************************************************************************************************