A PairingHeap is a heap with excellent empirical performance.
See: https://en.wikipedia.org/wiki/Pairing_heap in particular: https://en.wikipedia.org/wiki/Pairing_heap#Summary_of_running_times
Additionally, it supports an efficient O(1) combine operation
Attributes
- Companion:
- object
- Source:
- PairingHeap.scala
- Graph
- Supertypes
Members list
Value members
Abstract methods
Merge two heaps, this is O(1) work
Check to see if a predicate is ever true worst case O(N) but stops at the first true
Check to see if a predicate is ever true worst case O(N) but stops at the first true
Attributes
- Source:
- PairingHeap.scala
Check to see if a predicate is always true worst case O(N) but stops at the first false
Check to see if a predicate is always true worst case O(N) but stops at the first false
Attributes
- Source:
- PairingHeap.scala
Verifies if the heap is empty. O(1)
Returns min value on the heap, if it exists
Returns the size of the heap. O(1)
Concrete methods
Alias for add
insert an item into the heap O(1)
Attributes
- Source:
- PairingHeap.scala
This is O(N) in the worst case, but we use the heap property to be lazy
This is O(N) in the worst case, but we use the heap property to be lazy
Attributes
- Source:
- PairingHeap.scala
do a foldLeft in the same order as toList. requires an Order[A], which prevents us from making a Foldable[PairingHeap] instance.
do a foldLeft in the same order as toList. requires an Order[A], which prevents us from making a Foldable[PairingHeap] instance.
prefer unorderedFoldMap if you can express your operation as a commutative monoid since it is O(N) vs O(N log N) for this method
Attributes
- Source:
- PairingHeap.scala
Return true if this is not empty O(1)
Remove the min element from the heap (the root) and return it along with the updated heap. Order O(log n)
Remove the min element from the heap (the root) and return it along with the updated heap. Order O(log n)
Attributes
- Source:
- PairingHeap.scala
if not empty, remove the min, else return empty this is thought to be O(log N) (but not proven to be so)
if not empty, remove the min, else return empty this is thought to be O(log N) (but not proven to be so)
Attributes
- Source:
- PairingHeap.scala
Returns a sorted list of the elements within the heap. O(N log N)
Returns a sorted list of the elements within the heap. O(N log N)
Attributes
- Source:
- PairingHeap.scala
Similar to unorderedFoldMap without a transformation
Aggregate with a commutative monoid, since the Heap is not totally ordered
Aggregate with a commutative monoid, since the Heap is not totally ordered
Attributes
- Source:
- PairingHeap.scala