From b2ff5eda4dac46c906d7ba1ffda8be770beefbbf Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 4 Apr 2019 16:34:33 +0200 Subject: [PATCH 1/5] Documented BinaryHeap performance. --- src/liballoc/collections/binary_heap.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/liballoc/collections/binary_heap.rs b/src/liballoc/collections/binary_heap.rs index a171f128c24d6..2daf0b07983c0 100644 --- a/src/liballoc/collections/binary_heap.rs +++ b/src/liballoc/collections/binary_heap.rs @@ -165,6 +165,9 @@ use super::SpecExtend; /// trait, changes while it is in the heap. This is normally only possible /// through `Cell`, `RefCell`, global state, I/O, or unsafe code. /// +/// Both `push` and `pop` operations can be performed in `O(log(n))` time, whereas `peek` can be +/// performed in `O(1)` time. +/// /// # Examples /// /// ``` From 2920719f7f95820b3f6c120998543495d2c2c210 Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 5 Apr 2019 10:25:45 +0200 Subject: [PATCH 2/5] Break documentation at the right place. --- src/liballoc/collections/binary_heap.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/liballoc/collections/binary_heap.rs b/src/liballoc/collections/binary_heap.rs index 2daf0b07983c0..9559f3cb42e26 100644 --- a/src/liballoc/collections/binary_heap.rs +++ b/src/liballoc/collections/binary_heap.rs @@ -165,8 +165,8 @@ use super::SpecExtend; /// trait, changes while it is in the heap. This is normally only possible /// through `Cell`, `RefCell`, global state, I/O, or unsafe code. /// -/// Both `push` and `pop` operations can be performed in `O(log(n))` time, whereas `peek` can be -/// performed in `O(1)` time. +/// Both `push` and `pop` operations can be performed in `O(log(n))` time, +/// whereas `peek` can be performed in `O(1)` time. /// /// # Examples /// From dd353958949a92dd434c7e855fedf7f621bc652f Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 9 Apr 2019 15:18:23 +0200 Subject: [PATCH 3/5] Rephrased the performance details of BinaryHeap. --- src/liballoc/collections/binary_heap.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/liballoc/collections/binary_heap.rs b/src/liballoc/collections/binary_heap.rs index 9559f3cb42e26..77f872eaa9698 100644 --- a/src/liballoc/collections/binary_heap.rs +++ b/src/liballoc/collections/binary_heap.rs @@ -165,8 +165,10 @@ use super::SpecExtend; /// trait, changes while it is in the heap. This is normally only possible /// through `Cell`, `RefCell`, global state, I/O, or unsafe code. /// -/// Both `push` and `pop` operations can be performed in `O(log(n))` time, -/// whereas `peek` can be performed in `O(1)` time. +/// The costs of `push` and `pop` operations are `O(log(n))` whereas `peek` +/// can be performed in `O(1)` time. Note that the cost of a `push` +/// operation is an amortized cost which does not take into account potential +/// re-allocations when the current buffer cannot hold more elements. /// /// # Examples /// From 4b82287c6de5edd88075ab9c0f16d75b82007245 Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 20 Apr 2019 20:26:08 +0200 Subject: [PATCH 4/5] Rephrased the documentation of BinaryHeap. --- src/liballoc/collections/binary_heap.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/liballoc/collections/binary_heap.rs b/src/liballoc/collections/binary_heap.rs index 77f872eaa9698..0f9d98271a977 100644 --- a/src/liballoc/collections/binary_heap.rs +++ b/src/liballoc/collections/binary_heap.rs @@ -165,10 +165,9 @@ use super::SpecExtend; /// trait, changes while it is in the heap. This is normally only possible /// through `Cell`, `RefCell`, global state, I/O, or unsafe code. /// -/// The costs of `push` and `pop` operations are `O(log(n))` whereas `peek` -/// can be performed in `O(1)` time. Note that the cost of a `push` -/// operation is an amortized cost which does not take into account potential -/// re-allocations when the current buffer cannot hold more elements. +/// The costs of `push` and `pop` and `peek` can be performed in `O(1)` time. +/// Note that these are non-amortized costs. The amortized cost for `push` +/// and `pop` are `O(log(N)` due to re-allocations and maintaining the heap property. /// /// # Examples /// From 20a55861c5c330283b804a71371c0f7510289802 Mon Sep 17 00:00:00 2001 From: mzji Date: Sat, 4 May 2019 13:57:41 +0200 Subject: [PATCH 5/5] Update src/liballoc/collections/binary_heap.rs Co-Authored-By: DevQps <46896178+DevQps@users.noreply.github.com> --- src/liballoc/collections/binary_heap.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/liballoc/collections/binary_heap.rs b/src/liballoc/collections/binary_heap.rs index 0f9d98271a977..9da7f8711c288 100644 --- a/src/liballoc/collections/binary_heap.rs +++ b/src/liballoc/collections/binary_heap.rs @@ -167,7 +167,7 @@ use super::SpecExtend; /// /// The costs of `push` and `pop` and `peek` can be performed in `O(1)` time. /// Note that these are non-amortized costs. The amortized cost for `push` -/// and `pop` are `O(log(N)` due to re-allocations and maintaining the heap property. +/// and `pop` are `O(log(N))` due to re-allocations and maintaining the heap property. /// /// # Examples ///