Skip to content

Here is a collection of best-practice sorting algorithms that I have translated and optimized for use in VBA.

License

Notifications You must be signed in to change notification settings

SchildCode/VBA-sorting-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

VBA-sorting-algorithms

Here is a collection of best-practice sorting algorithms that I have translated and optimized for use in VBA.

Routine name Functionality
Quantile5 Stepwise EDF-fractile for presorted arr(1:NN), suitable for logged time-series data. This is R-type 5
Quantile Type of estimate or interpolation scheme as defined in the statistical package 'R' (5 to 9)
QuantileExact Calculates median fractile for a sampled EDF xx(1:NN), using exact BETA(a,b)=0.5 where alpha=m, beta=N+1-n. This is the precise version of estimator R-type=8 in routine Fractile()
PercentileExact Inverse discrete Empirical Distribution Function (EDF), i.e. outputs exact quantiles selected from cellRange without interpolation between values
QuickSort Non-recursive in-place Quick Sort algorithm (Hoare's algorithm) to sort a list in O(NlogN) time. This specific variant uses a three-way partition ("fat pivot"), called "Program 7" by Bentley & McIlroy, which is the best way of handling duplicate values, better than Dual-pivot variants
QuickSort2 Values in array arr() are output in ascending order of values in key(). Array key() is output in ascending order
QuickRank Ranks the values in array key(first:last), i.e., outputs the list of rank pointers array idx(first:last) such that the value with rank R is key(idx(R))
QuickSelect The k-th highest value is returned in location arr(k)
QuickQuantile Outputs weighted quantile for given fractile Pval
QuickQuantileRank Outputs weighted quantile for given fractile Pval
RepeatingQuantiles Same functionality as QuickQuantile, but using presorted lists, so that it is optimized for super-fast calling many times on the same array
QuickInsert Binary-search insert algorithm for presorted lists. Adds element aa to a presorted array arr(1:NN), resulting in arr(1:NN+1)
ShellSort Shell Sort for in-place sorting of an array. Shell Sort is almost as fast as QuickSort for small arrays, with O(n^1.25)
ShellSortRank Shell Sort for in-place indexing of an indexed array

About

Here is a collection of best-practice sorting algorithms that I have translated and optimized for use in VBA.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages