Module pivot

Source
๐Ÿ”ฌThis is a nightly-only experimental API. (slice_internals)
Expand description

This module contains the logic for pivot selection.

Constantsยง

PSEUDO_MEDIAN_REC_THRESHOLD ๐Ÿ”’ Experimental

Functionsยง

choose_pivotExperimental
Selects a pivot from v. Algorithm taken from glidesort by Orson Peters.
median3 ๐Ÿ”’ Experimental
Calculates the median of 3 elements.
median3_rec ๐Ÿ”’ โš Experimental
Calculates an approximate median of 3 elements from sections a, b, c, or recursively from an approximation of each, if theyโ€™re large enough. By dividing the size of each section by 8 when recursing we have logarithmic recursion depth and overall sample from f(n) = 3*f(n/8) -> f(n) = O(n^(log(3)/log(8))) ~= O(n^0.528) elements.