Skip to content

Commit e802713

Browse files
authored
Rollup merge of #106933 - schuelermine:fix/doc/102451, r=Amanieu
Update documentation of select_nth_unstable and select_nth_unstable_by to state O(n^2) complexity See #102451
2 parents 47ec320 + f1e649b commit e802713

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

library/core/src/slice/mod.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -2730,8 +2730,10 @@ impl<T> [T] {
27302730
/// This reordering has the additional property that any value at position `i < index` will be
27312731
/// less than or equal to any value at a position `j > index`. Additionally, this reordering is
27322732
/// unstable (i.e. any number of equal elements may end up at position `index`), in-place
2733-
/// (i.e. does not allocate), and *O*(*n*) worst-case. This function is also/ known as "kth
2734-
/// element" in other libraries. It returns a triplet of the following from the reordered slice:
2733+
/// (i.e. does not allocate), and *O*(*n*) on average. The worst-case performance is *O*(*n* log *n*).
2734+
/// This function is also known as "kth element" in other libraries.
2735+
///
2736+
/// It returns a triplet of the following from the reordered slice:
27352737
/// the subslice prior to `index`, the element at `index`, and the subslice after `index`;
27362738
/// accordingly, the values in those two subslices will respectively all be less-than-or-equal-to
27372739
/// and greater-than-or-equal-to the value of the element at `index`.
@@ -2777,8 +2779,11 @@ impl<T> [T] {
27772779
/// This reordering has the additional property that any value at position `i < index` will be
27782780
/// less than or equal to any value at a position `j > index` using the comparator function.
27792781
/// Additionally, this reordering is unstable (i.e. any number of equal elements may end up at
2780-
/// position `index`), in-place (i.e. does not allocate), and *O*(*n*) worst-case. This function
2781-
/// is also known as "kth element" in other libraries. It returns a triplet of the following from
2782+
/// position `index`), in-place (i.e. does not allocate), and *O*(*n*) on average.
2783+
/// The worst-case performance is *O*(*n* log *n*). This function is also known as
2784+
/// "kth element" in other libraries.
2785+
///
2786+
/// It returns a triplet of the following from
27822787
/// the slice reordered according to the provided comparator function: the subslice prior to
27832788
/// `index`, the element at `index`, and the subslice after `index`; accordingly, the values in
27842789
/// those two subslices will respectively all be less-than-or-equal-to and greater-than-or-equal-to
@@ -2829,8 +2834,11 @@ impl<T> [T] {
28292834
/// This reordering has the additional property that any value at position `i < index` will be
28302835
/// less than or equal to any value at a position `j > index` using the key extraction function.
28312836
/// Additionally, this reordering is unstable (i.e. any number of equal elements may end up at
2832-
/// position `index`), in-place (i.e. does not allocate), and *O*(*n*) worst-case. This function
2833-
/// is also known as "kth element" in other libraries. It returns a triplet of the following from
2837+
/// position `index`), in-place (i.e. does not allocate), and *O*(*n*) on average.
2838+
/// The worst-case performance is *O*(*n* log *n*).
2839+
/// This function is also known as "kth element" in other libraries.
2840+
///
2841+
/// It returns a triplet of the following from
28342842
/// the slice reordered according to the provided key extraction function: the subslice prior to
28352843
/// `index`, the element at `index`, and the subslice after `index`; accordingly, the values in
28362844
/// those two subslices will respectively all be less-than-or-equal-to and greater-than-or-equal-to

0 commit comments

Comments
 (0)