Skip to content

Commit 0212dff

Browse files
author
Jim Apple
committed
Pop on binary heaps does not have constant time complexity.
pop calls siftdown, siftdown calls siftdown_range, and siftdown_range loops on an index that can start as low as 0 and approximately doubles each iteration.
1 parent 21ba1d5 commit 0212dff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcollections/binary_heap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
//! A priority queue implemented with a binary heap.
1212
//!
13-
//! Insertions have `O(log n)` time complexity and checking or popping the largest element is
14-
//! `O(1)`. Converting a vector to a priority queue can be done in-place, and has `O(n)`
13+
//! Insertion and popping the largest element have `O(log n)` time complexity. Checking the largest
14+
//! element is `O(1)`. Converting a vector to a priority queue can be done in-place, and has `O(n)`
1515
//! complexity. A priority queue can also be converted to a sorted vector in-place, allowing it to
1616
//! be used for an `O(n log n)` in-place heapsort.
1717
//!

0 commit comments

Comments
 (0)