diff options
| author | Ryan Scott <ryan@ryan-scott.me> | 2020-10-14 16:50:00 +1100 |
|---|---|---|
| committer | Ryan Scott <rscott@zendesk.com> | 2020-10-15 23:21:14 +1100 |
| commit | 000ec5e2f8e7bf3f5da59f6f219fe02dff42d116 (patch) | |
| tree | 74cee4b19f98762560e8187f1cf52837699eca3e /library/alloc/src | |
| parent | 1fe9b7f3fe5781a0fdf57d89c39048cb960f3040 (diff) | |
| download | rust-000ec5e2f8e7bf3f5da59f6f219fe02dff42d116.tar.gz rust-000ec5e2f8e7bf3f5da59f6f219fe02dff42d116.zip | |
Made slice sort documentation consistent between stable and unstable versions
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/slice.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/library/alloc/src/slice.rs b/library/alloc/src/slice.rs index 79403cf8687..706d563f8fb 100644 --- a/library/alloc/src/slice.rs +++ b/library/alloc/src/slice.rs @@ -169,7 +169,7 @@ mod hack { impl<T> [T] { /// Sorts the slice. /// - /// This sort is stable (i.e., does not reorder equal elements) and `O(n * log(n))` worst-case. + /// This sort is stable (i.e., does not reorder equal elements) and *O*(*n* \* log(*n*)) worst-case. /// /// When applicable, unstable sorting is preferred because it is generally faster than stable /// sorting and it doesn't allocate auxiliary memory. @@ -204,7 +204,7 @@ impl<T> [T] { /// Sorts the slice with a comparator function. /// - /// This sort is stable (i.e., does not reorder equal elements) and `O(n * log(n))` worst-case. + /// This sort is stable (i.e., does not reorder equal elements) and *O*(*n* \* log(*n*)) worst-case. /// /// The comparator function must define a total ordering for the elements in the slice. If /// the ordering is not total, the order of the elements is unspecified. An order is a @@ -258,8 +258,8 @@ impl<T> [T] { /// Sorts the slice with a key extraction function. /// - /// This sort is stable (i.e., does not reorder equal elements) and `O(m * n * log(n))` - /// worst-case, where the key function is `O(m)`. + /// This sort is stable (i.e., does not reorder equal elements) and *O*(*m* \* *n* \* log(*n*)) + /// worst-case, where the key function is *O*(*m*). /// /// For expensive key functions (e.g. functions that are not simple property accesses or /// basic operations), [`sort_by_cached_key`](#method.sort_by_cached_key) is likely to be @@ -301,8 +301,8 @@ impl<T> [T] { /// /// 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))` - /// worst-case, where the key function is `O(m)`. + /// This sort is stable (i.e., does not reorder equal elements) and *O*(*m* \* *n* + *n* \* log(*n*)) + /// worst-case, where the key function is *O*(*m*). /// /// For simple key functions (e.g., functions that are property accesses or /// basic operations), [`sort_by_key`](#method.sort_by_key) is likely to be @@ -946,7 +946,7 @@ where /// 1. for every `i` in `1..runs.len()`: `runs[i - 1].len > runs[i].len` /// 2. for every `i` in `2..runs.len()`: `runs[i - 2].len > runs[i - 1].len + runs[i].len` /// -/// The invariants ensure that the total running time is `O(n * log(n))` worst-case. +/// The invariants ensure that the total running time is *O*(*n* \* log(*n*)) worst-case. fn merge_sort<T, F>(v: &mut [T], mut is_less: F) where F: FnMut(&T, &T) -> bool, |
