11//! A priority queue implemented with a binary heap. 
22//! 
3- //! Insertion and popping the largest element have `O (log(n))`  time complexity. 
4- //! Checking the largest element is `O (1)` . Converting a vector to a binary heap 
5- //! can be done in-place, and has `O(n)`  complexity. A binary heap can also be 
6- //! converted to a sorted vector in-place, allowing it to be used for an `O(n  * log(n))`  
3+ //! Insertion and popping the largest element have *O* (log(*n*))  time complexity. 
4+ //! Checking the largest element is *O* (1). Converting a vector to a binary heap 
5+ //! can be done in-place, and has *O*(*n*)  complexity. A binary heap can also be 
6+ //! converted to a sorted vector in-place, allowing it to be used for an *O*(*n* \ * log(*n*))  
77//! in-place heapsort. 
88//! 
99//! # Examples 
@@ -235,7 +235,7 @@ use super::SpecExtend;
235235/// 
236236/// | [push] | [pop]     | [peek]/[peek\_mut] | 
237237/// |--------|-----------|--------------------| 
238- /// | O(1)~  | O (log(n )) | O (1)               | 
238+ /// | O(1)~  | *O* (log(*n* )) | *O* (1)               | 
239239/// 
240240/// The value for `push` is an expected cost; the method documentation gives a 
241241/// more detailed analysis. 
@@ -398,7 +398,7 @@ impl<T: Ord> BinaryHeap<T> {
398398     /// 
399399     /// # Time complexity 
400400     /// 
401-      /// Cost is `O (1)`  in the worst case. 
401+      /// Cost is *O* (1) in the worst case. 
402402     #[ stable( feature = "binary_heap_peek_mut" ,  since = "1.12.0" ) ]  
403403    pub  fn  peek_mut ( & mut  self )  -> Option < PeekMut < ' _ ,  T > >  { 
404404        if  self . is_empty ( )  {  None  }  else  {  Some ( PeekMut  {  heap :  self ,  sift :  true  } )  } 
@@ -422,7 +422,7 @@ impl<T: Ord> BinaryHeap<T> {
422422     /// 
423423     /// # Time complexity 
424424     /// 
425-      /// The worst case cost of `pop` on a heap containing *n* elements is `O (log(n))` . 
425+      /// The worst case cost of `pop` on a heap containing *n* elements is *O* (log(*n*)) . 
426426     #[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
427427    pub  fn  pop ( & mut  self )  -> Option < T >  { 
428428        self . data . pop ( ) . map ( |mut  item| { 
@@ -455,15 +455,15 @@ impl<T: Ord> BinaryHeap<T> {
455455     /// 
456456     /// The expected cost of `push`, averaged over every possible ordering of 
457457     /// the elements being pushed, and over a sufficiently large number of 
458-      /// pushes, is `O (1)` . This is the most meaningful cost metric when pushing 
458+      /// pushes, is *O* (1). This is the most meaningful cost metric when pushing 
459459     /// elements that are *not* already in any sorted pattern. 
460460     /// 
461461     /// The time complexity degrades if elements are pushed in predominantly 
462462     /// ascending order. In the worst case, elements are pushed in ascending 
463-      /// sorted order and the amortized cost per push is `O (log(n))`  against a heap 
463+      /// sorted order and the amortized cost per push is *O* (log(*n*))  against a heap 
464464     /// containing *n* elements. 
465465     /// 
466-      /// The worst case cost of a *single* call to `push` is `O(n)` . The worst case 
466+      /// The worst case cost of a *single* call to `push` is *O*(*n*) . The worst case 
467467     /// occurs when capacity is exhausted and needs a resize. The resize cost 
468468     /// has been amortized in the previous figures. 
469469     #[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
@@ -643,7 +643,7 @@ impl<T: Ord> BinaryHeap<T> {
643643     /// The remaining elements will be removed on drop in heap order. 
644644     /// 
645645     /// Note: 
646-      /// * `.drain_sorted()` is `O(n  * log(n))` ; much slower than `.drain()`. 
646+      /// * `.drain_sorted()` is *O*(*n* \ * log(*n*)) ; much slower than `.drain()`. 
647647     ///   You should use the latter for most cases. 
648648     /// 
649649     /// # Examples 
@@ -756,7 +756,7 @@ impl<T> BinaryHeap<T> {
756756     /// 
757757     /// # Time complexity 
758758     /// 
759-      /// Cost is `O (1)`  in the worst case. 
759+      /// Cost is *O* (1) in the worst case. 
760760     #[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
761761    pub  fn  peek ( & self )  -> Option < & T >  { 
762762        self . data . get ( 0 ) 
@@ -1312,7 +1312,7 @@ unsafe impl<T: Ord> TrustedLen for DrainSorted<'_, T> {}
13121312impl < T :  Ord >  From < Vec < T > >  for  BinaryHeap < T >  { 
13131313    /// Converts a `Vec<T>` into a `BinaryHeap<T>`. 
13141314     /// 
1315-      /// This conversion happens in-place, and has `O(n)`  time complexity. 
1315+      /// This conversion happens in-place, and has *O*(*n*)  time complexity. 
13161316     fn  from ( vec :  Vec < T > )  -> BinaryHeap < T >  { 
13171317        let  mut  heap = BinaryHeap  {  data :  vec } ; 
13181318        heap. rebuild ( ) ; 
0 commit comments