phobosSort



T[] newVoid(T)(size_t length);
Returns a new T[], skipping initialization. Useful when fast memory allocation is necessary, and the initial values are definitely not going to be used.

void rotateRight(T)(T[] input);
Helper function for stableSelectionSort.

T[0] qsort(T...)(T data);
Unstable quick multisort. Sorts N arrays by first array. Faster than stable version, and sorts in place.

T[0] stableQsort(T...)(T data);
Stable version of qsort() function. Does not sort in place, and is about 15% slower than unstable version, so use only when necessary. Also, performance is O(N^2) on pre-sorted arrays, because choosing an intelligent pivot is difficult or impossible in a stable qsort. stableQsort creates temp variables and forwards all data to stableQsortBackEnd. However, stableQsortBackEnd is callable directly, in case the user wants to recycle pre-allocated temp space.

T[0] mergeSort(T...)(T data);
Merge multisort. Takes in N arrays and sorts them by the first array. If last argument is a ulong*, increments this by the number of swaps that would have been necessary to bubble sort the data. This is useful for calculating statistical functions like Kendall correlation. Slower than stableQsort on average, use only if you need to count the swaps for some statistical function, or if you need O(N log N) worst case performance. Like stableQsort(), front end function creates temp variables and forwards them to back end function.

void merge(T...)(T data);
Merge function for merge sort.

T[0] bubbleSort(T...)(T data);
Bubble multisort function. Useful only because it's easy to implement and test other sorting functions against. Counts swaps if last argument is a ulong*.

T[0] selectionSort(T...)(T data);
Unstable selection sort. Used for small subarrays in qsort.

T[0] stableSelectionSort(T...)(T data);
Stable selection sort. Used for small subarrays in stableQsort and mergeSort. If last argument is a ulong*, keeps track of number of swaps that would have been necessary if this were a bubble sort.


Page generated by Ddoc.