Skip to content

Commit

Permalink
Rollup merge of rust-lang#111973 - Sp00ph:update_current_impl, r=Amanieu
Browse files Browse the repository at this point in the history
Update current implementation comments for `select_nth_unstable`

This more accurately reflects the actual implementation, as it hasn't been a simple quickselect since rust-lang#106997. While it does say that the current implementation always runs in O(n), I don't think it should require an FCP as it doesn't guarantee linearity in general and only points out that the current implementation is in fact linear.

r? `@Amanieu`
  • Loading branch information
matthiaskrgr committed May 26, 2023
2 parents e7068ff + ea32791 commit 18398ad
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3005,8 +3005,9 @@ impl<T> [T] {
///
/// # Current implementation
///
/// The current algorithm is based on the quickselect portion of the same quicksort algorithm
/// used for [`sort_unstable`].
/// The current algorithm is an introselect implementation based on Pattern Defeating Quicksort, which is also
/// the basis for [`sort_unstable`]. The fallback algorithm is Median of Medians using Tukey's Ninther for
/// pivot selection, which guarantees linear runtime for all inputs.
///
/// [`sort_unstable`]: slice::sort_unstable
///
Expand Down Expand Up @@ -3056,8 +3057,9 @@ impl<T> [T] {
///
/// # Current implementation
///
/// The current algorithm is based on the quickselect portion of the same quicksort algorithm
/// used for [`sort_unstable`].
/// The current algorithm is an introselect implementation based on Pattern Defeating Quicksort, which is also
/// the basis for [`sort_unstable`]. The fallback algorithm is Median of Medians using Tukey's Ninther for
/// pivot selection, which guarantees linear runtime for all inputs.
///
/// [`sort_unstable`]: slice::sort_unstable
///
Expand Down

0 comments on commit 18398ad

Please sign in to comment.