core::collections::heap
API 참조는 영어로만 있습니다. 표준 라이브러리 소스의 영어 문서 주석에서 만듭니다.
BinaryHeap<T>, a priority queue
over a List laid out as an implicit binary tree. new() pops the
greatest item first; by_ordering(cmp) pops the greatest by cmp.
Structs
BinaryHeapSource
pub struct BinaryHeap<T>A priority queue: new() pops the greatest item first,
by_ordering(cmp) the greatest by cmp.
A max-heap.
A heap whose top is the greatest item by
cmp, asnew()is byOrd::cmp:by_ordering(|a, b| b.cmp(a))pops the least first.The number of items.
truewhen the heap holds no item.The top item.
Add
x; O(log n).Remove and return the top item; O(log n).
Drop every item.
Keep only the items
keepaccepts, in place; O(n).Every item, in no particular order.
Trait implementations 6
impl<T> !Sync for BinaryHeap<T>impl<T> IntoIterator for BinaryHeap<T>impl<T: Ord> Default for BinaryHeap<T>impl<T: Clone> Clone for BinaryHeap<T>impl<T: Ord> FromIterator<T> for BinaryHeap<T>impl<T: Debug> Debug for BinaryHeap<T>
HeapIterSource
pub struct HeapIter<T>The items of a heap, in no particular order.
Trait implementations 3
impl<T> Debug for HeapIter<T>impl<T> Iterator for HeapIter<T>impl<T> ExactSizeIterator for HeapIter<T>