Skip to content

Commit f1e649b

Browse files
committed
Update documentation of select_nth_unstable and select_nth_unstable_by and select_nth_unstable_by_key to state O(n log n) worst case complexity
Also remove erronious / in doc comment
1 parent 6d46b1e commit f1e649b

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
@@ -2708,8 +2708,10 @@ impl<T> [T] {
27082708
/// This reordering has the additional property that any value at position `i < index` will be
27092709
/// less than or equal to any value at a position `j > index`. Additionally, this reordering is
27102710
/// unstable (i.e. any number of equal elements may end up at position `index`), in-place
2711-
/// (i.e. does not allocate), and *O*(*n*) worst-case. This function is also/ known as "kth
2712-
/// element" in other libraries. It returns a triplet of the following from the reordered slice:
2711+
/// (i.e. does not allocate), and *O*(*n*) on average. The worst-case performance is *O*(*n* log *n*).
2712+
/// This function is also known as "kth element" in other libraries.
2713+
///
2714+
/// It returns a triplet of the following from the reordered slice:
27132715
/// the subslice prior to `index`, the element at `index`, and the subslice after `index`;
27142716
/// accordingly, the values in those two subslices will respectively all be less-than-or-equal-to
27152717
/// and greater-than-or-equal-to the value of the element at `index`.
@@ -2755,8 +2757,11 @@ impl<T> [T] {
27552757
/// This reordering has the additional property that any value at position `i < index` will be
27562758
/// less than or equal to any value at a position `j > index` using the comparator function.
27572759
/// Additionally, this reordering is unstable (i.e. any number of equal elements may end up at
2758-
/// position `index`), in-place (i.e. does not allocate), and *O*(*n*) worst-case. This function
2759-
/// is also known as "kth element" in other libraries. It returns a triplet of the following from
2760+
/// position `index`), in-place (i.e. does not allocate), and *O*(*n*) on average.
2761+
/// The worst-case performance is *O*(*n* log *n*). This function is also known as
2762+
/// "kth element" in other libraries.
2763+
///
2764+
/// It returns a triplet of the following from
27602765
/// the slice reordered according to the provided comparator function: the subslice prior to
27612766
/// `index`, the element at `index`, and the subslice after `index`; accordingly, the values in
27622767
/// those two subslices will respectively all be less-than-or-equal-to and greater-than-or-equal-to
@@ -2807,8 +2812,11 @@ impl<T> [T] {
28072812
/// This reordering has the additional property that any value at position `i < index` will be
28082813
/// less than or equal to any value at a position `j > index` using the key extraction function.
28092814
/// Additionally, this reordering is unstable (i.e. any number of equal elements may end up at
2810-
/// position `index`), in-place (i.e. does not allocate), and *O*(*n*) worst-case. This function
2811-
/// is also known as "kth element" in other libraries. It returns a triplet of the following from
2815+
/// position `index`), in-place (i.e. does not allocate), and *O*(*n*) on average.
2816+
/// The worst-case performance is *O*(*n* log *n*).
2817+
/// This function is also known as "kth element" in other libraries.
2818+
///
2819+
/// It returns a triplet of the following from
28122820
/// the slice reordered according to the provided key extraction function: the subslice prior to
28132821
/// `index`, the element at `index`, and the subslice after `index`; accordingly, the values in
28142822
/// those two subslices will respectively all be less-than-or-equal-to and greater-than-or-equal-to

0 commit comments

Comments
 (0)