diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2021-09-25 18:22:20 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-25 18:22:20 -0700 |
| commit | 653dcaac2b9b647ebcf417dbc1e55341c10160b9 (patch) | |
| tree | bad03149285ff2b553f5dafb85379089fb2bba9d /library/alloc/src | |
| parent | c118d8b79b2e10d6922423ecb6162ffe8f5d07fb (diff) | |
| parent | 956f87fb04f589ac2fbe262a043c9f3cad6b2ac0 (diff) | |
| download | rust-653dcaac2b9b647ebcf417dbc1e55341c10160b9.tar.gz rust-653dcaac2b9b647ebcf417dbc1e55341c10160b9.zip | |
Rollup merge of #89216 - r00ster91:bigo, r=dtolnay
Consistent big O notation This makes the big O time complexity notation in places with markdown support more consistent. Inspired by #89210
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/collections/binary_heap.rs | 8 | ||||
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/library/alloc/src/collections/binary_heap.rs b/library/alloc/src/collections/binary_heap.rs index 31355387224..4ed3702f7d2 100644 --- a/library/alloc/src/collections/binary_heap.rs +++ b/library/alloc/src/collections/binary_heap.rs @@ -3,7 +3,7 @@ //! Insertion and popping the largest element have *O*(log(*n*)) time complexity. //! Checking the largest element is *O*(1). Converting a vector to a binary heap //! can be done in-place, and has *O*(*n*) complexity. A binary heap can also be -//! converted to a sorted vector in-place, allowing it to be used for an *O*(*n* \* log(*n*)) +//! converted to a sorted vector in-place, allowing it to be used for an *O*(*n* * log(*n*)) //! in-place heapsort. //! //! # Examples @@ -243,9 +243,9 @@ use super::SpecExtend; /// /// # Time complexity /// -/// | [push] | [pop] | [peek]/[peek\_mut] | -/// |--------|-----------|--------------------| -/// | O(1)~ | *O*(log(*n*)) | *O*(1) | +/// | [push] | [pop] | [peek]/[peek\_mut] | +/// |---------|---------------|--------------------| +/// | *O*(1)~ | *O*(log(*n*)) | *O*(1) | /// /// The value for `push` is an expected cost; the method documentation gives a /// more detailed analysis. diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 2ee91f88d3c..4440b1f599f 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -1,8 +1,8 @@ //! A contiguous growable array type with heap-allocated contents, written //! `Vec<T>`. //! -//! Vectors have `O(1)` indexing, amortized `O(1)` push (to the end) and -//! `O(1)` pop (from the end). +//! Vectors have *O*(1) indexing, amortized *O*(1) push (to the end) and +//! *O*(1) pop (from the end). //! //! Vectors ensure they never allocate more than `isize::MAX` bytes. //! @@ -1270,7 +1270,7 @@ impl<T, A: Allocator> Vec<T, A> { /// /// The removed element is replaced by the last element of the vector. /// - /// This does not preserve ordering, but is O(1). + /// This does not preserve ordering, but is *O*(1). /// /// # Panics /// |
