Skip to content

Commit fa1a878

Browse files
committed
add time complexity for into_sorted_vec
1 parent cebba31 commit fa1a878

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

library/alloc/src/collections/binary_heap.rs

+4
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,10 @@ impl<T: Ord> BinaryHeap<T> {
506506
/// let vec = heap.into_sorted_vec();
507507
/// assert_eq!(vec, [1, 2, 3, 4, 5, 6, 7]);
508508
/// ```
509+
///
510+
/// # Time complexity
511+
///
512+
/// The time complexity of `into_sorted_vec` on a heap containing `n` items is *O*(*n*log(*n*)).
509513
#[stable(feature = "binary_heap_extras_15", since = "1.5.0")]
510514
pub fn into_sorted_vec(mut self) -> Vec<T> {
511515
let mut end = self.len();

0 commit comments

Comments
 (0)