Update documentation for sort_by_key

This commit is contained in:
varkor
2018-03-01 12:15:05 +00:00
parent ea6a1bdf6b
commit 670e69e207

View File

@@ -1302,11 +1302,9 @@ impl<T> [T] {
/// Sorts the slice with a key extraction function. /// Sorts the slice with a key extraction function.
/// ///
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case. /// During sorting, the key function is called only once per element.
/// /// This sort is stable (i.e. does not reorder equal elements) and `O(m n + n log n)`
/// When applicable, unstable sorting is preferred because it is generally faster than stable /// worst-case, where the key function is `O(m)`.
/// sorting and it doesn't allocate auxiliary memory.
/// See [`sort_unstable_by_key`](#method.sort_unstable_by_key).
/// ///
/// # Current implementation /// # Current implementation
/// ///
@@ -1315,8 +1313,7 @@ impl<T> [T] {
/// It is designed to be very fast in cases where the slice is nearly sorted, or consists of /// It is designed to be very fast in cases where the slice is nearly sorted, or consists of
/// two or more sorted sequences concatenated one after another. /// two or more sorted sequences concatenated one after another.
/// ///
/// Also, it allocates temporary storage half the size of `self`, but for short slices a /// The algorithm allocates temporary storage the size of `self`.
/// non-allocating insertion sort is used instead.
/// ///
/// # Examples /// # Examples
/// ///