linear-base-0.5.0: Standard library for linear types.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simple.Quicksort

Description

This module implements quicksort with mutable arrays from linear-base

Synopsis

Documentation

quicksortUsingList :: Ord a => [a] -> [a] Source #

quicksortUsingArray :: Ord a => [a] -> [a] Source #

quicksortArray :: Ord a => Array a %1 -> Array a Source #

go :: Ord a => Int -> Int -> Array a %1 -> Array a Source #

partition :: Ord a => Array a %1 -> a -> Int -> Int -> (Array a, Ur Int) Source #

partition arr pivot lo hi = (arr', Ur ix) such that arr'[i] <= pivot for lo <= i <= ix, arr'[j] > pivot for ix < j <= hi, arr'[k] = arr[k] for k < lo and k > hi, and arr' is a permutation of arr.

swap :: HasCallStack => Array a %1 -> Int -> Int -> Array a Source #

swap a i j exchanges the positions of values at i and j of a.