iota-0.1.0.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Vector.Sort.Quick

Synopsis

Documentation

quickSort :: (Ord a, PrimMonad m, MVector mv a) => mv (PrimState m) a -> m () Source #

Random Pivot Quick Sort

O(n log n)

quickSortBy :: (PrimMonad m, MVector mv a) => (a -> a -> Ordering) -> mv (PrimState m) a -> m () Source #

Random Pivot Quick Sort

O(n log n)

quickSelect :: (Ord a, PrimMonad m, MVector mv a) => mv (PrimState m) a -> Int -> m a Source #

Random Pivot Quick Select

O(n)

quickSelectBy :: (PrimMonad m, MVector mv a) => (a -> a -> Ordering) -> mv (PrimState m) a -> Int -> m a Source #

Random Pivot Quick Select

O(n)

pivotPartitionBy :: (PrimMonad m, MVector mv a) => (a -> a -> Ordering) -> mv (PrimState m) a -> a -> m Int Source #

getMedian3PivotBy :: (PrimMonad m, MVector mv a) => (a -> a -> Ordering) -> mv (PrimState m) a -> m a Source #

medianBy :: (a -> a -> Ordering) -> a -> a -> a -> a Source #

>>> medianBy compare 3 1 2
2

insertionSortBy :: (MVector mv a, PrimMonad m) => (a -> a -> Ordering) -> mv (PrimState m) a -> m () Source #