Fix time complexity in BinaryHeap::peek_mut docs

This commit is contained in:
Giacomo Stevanato 2020-09-20 01:07:34 +02:00
parent af1e3633f7
commit ca15e9d8a1
1 changed files with 2 additions and 1 deletions

View File

@ -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 }) }