Skip to content

Commit ca15e9d

Browse files
committed
Fix time complexity in BinaryHeap::peek_mut docs
1 parent af1e363 commit ca15e9d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/alloc/src/collections/binary_heap.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ impl<T: Ord> BinaryHeap<T> {
399399
///
400400
/// # Time complexity
401401
///
402-
/// Cost is *O*(1) in the worst case.
402+
/// If the item is modified then the worst case time complexity is *O*(log(*n*)),
403+
/// otherwise it's *O*(1).
403404
#[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
404405
pub fn peek_mut(&mut self) -> Option<PeekMut<'_, T>> {
405406
if self.is_empty() { None } else { Some(PeekMut { heap: self, sift: false }) }

0 commit comments

Comments
 (0)