Skip to main content

Module pivot

Module pivot 

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

This module contains the logic for pivot selection.

Re-exportsΒ§

use crate::hint; πŸ”’
use crate::intrinsics; πŸ”’ Experimental

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.