diff options
| author | Jim Apple <jbapple+rust@google.com> | 2014-12-01 18:12:48 -0800 |
|---|---|---|
| committer | Jim Apple <jbapple+rust@google.com> | 2014-12-01 18:12:48 -0800 |
| commit | 0212dff902da3d50123b6dc02fa0da250ddc0da4 (patch) | |
| tree | 7508a74326321e9069e38bceeaec0c639415adac /src | |
| parent | 21ba1d5e58144c83093a8cbb467a6c9cb12fc4a1 (diff) | |
| download | rust-0212dff902da3d50123b6dc02fa0da250ddc0da4.tar.gz rust-0212dff902da3d50123b6dc02fa0da250ddc0da4.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcollections/binary_heap.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index cbf45ee36a3..330b9392974 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -10,8 +10,8 @@ //! A priority queue implemented with a binary heap. //! -//! Insertions have `O(log n)` time complexity and checking or popping the largest element is -//! `O(1)`. Converting a vector to a priority queue can be done in-place, and has `O(n)` +//! Insertion and popping the largest element have `O(log n)` time complexity. Checking the largest +//! element is `O(1)`. Converting a vector to a priority queue can be done in-place, and has `O(n)` //! complexity. A priority queue can also be converted to a sorted vector in-place, allowing it to //! be used for an `O(n log n)` in-place heapsort. //! |
