Skip to content

Commit 18398ad

Browse files
authored
Rollup merge of #111973 - Sp00ph:update_current_impl, r=Amanieu
Update current implementation comments for `select_nth_unstable` This more accurately reflects the actual implementation, as it hasn't been a simple quickselect since #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`
2 parents e7068ff + ea32791 commit 18398ad

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

library/core/src/slice/mod.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -3005,8 +3005,9 @@ impl<T> [T] {
30053005
///
30063006
/// # Current implementation
30073007
///
3008-
/// The current algorithm is based on the quickselect portion of the same quicksort algorithm
3009-
/// used for [`sort_unstable`].
3008+
/// The current algorithm is an introselect implementation based on Pattern Defeating Quicksort, which is also
3009+
/// the basis for [`sort_unstable`]. The fallback algorithm is Median of Medians using Tukey's Ninther for
3010+
/// pivot selection, which guarantees linear runtime for all inputs.
30103011
///
30113012
/// [`sort_unstable`]: slice::sort_unstable
30123013
///
@@ -3056,8 +3057,9 @@ impl<T> [T] {
30563057
///
30573058
/// # Current implementation
30583059
///
3059-
/// The current algorithm is based on the quickselect portion of the same quicksort algorithm
3060-
/// used for [`sort_unstable`].
3060+
/// The current algorithm is an introselect implementation based on Pattern Defeating Quicksort, which is also
3061+
/// the basis for [`sort_unstable`]. The fallback algorithm is Median of Medians using Tukey's Ninther for
3062+
/// pivot selection, which guarantees linear runtime for all inputs.
30613063
///
30623064
/// [`sort_unstable`]: slice::sort_unstable
30633065
///

0 commit comments

Comments
 (0)