Expand description
Parallel quicksort.
This implementation is copied verbatim from std::slice::sort_unstable
and then parallelized.
The only difference from the original is that calls to recurse
are executed in parallel using
rayon_core::join
.
Structs§
- When dropped, copies from
src
intodest
.
Functions§
- Scatters some elements around in an attempt to break patterns that might cause imbalanced partitions in quicksort.
- Chooses a pivot in
v
and returns the index andtrue
if the slice is likely already sorted. - heapsort 🔒Sorts
v
using heapsort, which guarantees O(n * log(n)) worst-case. - Sorts a slice using insertion sort, which is O(n^2) worst-case.
- Sorts
v
using pattern-defeating quicksort in parallel. - Partially sorts a slice by shifting several out-of-order elements around.
- Partitions
v
into elements smaller thanv[pivot]
, followed by elements greater than or equal tov[pivot]
. - Partitions
v
into elements equal tov[pivot]
followed by elements greater thanv[pivot]
. - Partitions
v
into elements smaller thanpivot
, followed by elements greater than or equal topivot
. - recurse 🔒Sorts
v
recursively. - Shifts the first element to the right until it encounters a greater or equal element.
- Shifts the last element to the left until it encounters a smaller or equal element.