diff options
| author | Giacomo Stevanato <giaco.stevanato@gmail.com> | 2020-09-20 01:07:34 +0200 |
|---|---|---|
| committer | Giacomo Stevanato <giaco.stevanato@gmail.com> | 2020-09-20 01:12:02 +0200 |
| commit | ca15e9d8a11e7c25eb85930d1da3009647c1680e (patch) | |
| tree | ac4f64480082bdecbea3f8e592a30d77bd2dd7d3 | |
| parent | af1e3633f734930a50000cc424fbcdc6629885c3 (diff) | |
| download | rust-ca15e9d8a11e7c25eb85930d1da3009647c1680e.tar.gz rust-ca15e9d8a11e7c25eb85930d1da3009647c1680e.zip | |
Fix time complexity in BinaryHeap::peek_mut docs
| -rw-r--r-- | library/alloc/src/collections/binary_heap.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/alloc/src/collections/binary_heap.rs b/library/alloc/src/collections/binary_heap.rs index e3b738a70c8..06e5ac037ca 100644 --- a/library/alloc/src/collections/binary_heap.rs +++ b/library/alloc/src/collections/binary_heap.rs @@ -399,7 +399,8 @@ impl<T: Ord> BinaryHeap<T> { /// /// # Time complexity /// - /// Cost is *O*(1) in the worst case. + /// If the item is modified then the worst case time complexity is *O*(log(*n*)), + /// otherwise it's *O*(1). #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")] pub fn peek_mut(&mut self) -> Option<PeekMut<'_, T>> { if self.is_empty() { None } else { Some(PeekMut { heap: self, sift: false }) } |
