Function Array Sorts Class

SortVariantVector

"Sort Variant Vector Elements" Non-recursive Quick Sort of the elements of a one-dimensional variant array.

Signature (Visual Basic / VBA)

Public Function SortVariantVector( _
      ByRef rArray() As Variant _
    , Optional ByVal vCompare As Variant _
    , Optional ByVal vStable As Variant _
    ) As Boolean

Notes & Version History

Remarks No need for this sort to be stable, since it is only sorting one column. Sorts elements Array(1)...Array(UpperBound) in variant array. See also the PartitionVariantVector function. I refer you to "Sorting and Searching" by Donald Knuth for a detailed explanation of the Quick Sort algorithm. This version started with the simple recursive definition of the Quick Sort function then the recursion was removed from the Sort phase of the algorithm and the Partition function was macroized (the Call to the Partition function was replaced by its definition).