๐ฌ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_
pivot Experimental - 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.