Module rayon::slice::quicksort

source ยท
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ยง

  • CopyOnDrop ๐Ÿ”’
    When dropped, copies from src into dest.

Functionsยง

  • break_patterns ๐Ÿ”’
    Scatters some elements around in an attempt to break patterns that might cause imbalanced partitions in quicksort.
  • choose_pivot ๐Ÿ”’
    Chooses a pivot in v and returns the index and true if the slice is likely already sorted.
  • heapsort ๐Ÿ”’
    Sorts v using heapsort, which guarantees O(n * log(n)) worst-case.
  • insertion_sort ๐Ÿ”’
    Sorts a slice using insertion sort, which is O(n^2) worst-case.
  • par_quicksort ๐Ÿ”’
    Sorts v using pattern-defeating quicksort in parallel.
  • Partially sorts a slice by shifting several out-of-order elements around.
  • partition ๐Ÿ”’
    Partitions v into elements smaller than v[pivot], followed by elements greater than or equal to v[pivot].
  • partition_equal ๐Ÿ”’
    Partitions v into elements equal to v[pivot] followed by elements greater than v[pivot].
  • Partitions v into elements smaller than pivot, followed by elements greater than or equal to pivot.
  • recurse ๐Ÿ”’
    Sorts v recursively.
  • shift_head ๐Ÿ”’
    Shifts the first element to the right until it encounters a greater or equal element.
  • shift_tail ๐Ÿ”’
    Shifts the last element to the left until it encounters a smaller or equal element.