Function
Static Public Summary | ||
public |
Decrease-key: remove the subtree rooted at the key to be decreased, replace the key with a smaller key, then merge the result back into the heap. |
|
public |
Merge: compare the two root elements, the smaller remains the root of the result, the larger element and its subtree is appended as a child of this root. |
|
public |
mergepairs(compare: Function, prev: Node): Node Recursively builds a heap from an iterator of nodes by merging them pair by pair. |
|
public |
Set B as the first child of A. |
Static Public
public decreasekey(compare: Function, min: Node, node: Node, value: Object): Node source
import decreasekey from '@heap-data-structure/pairing-heap/src/decreasekey.js'
Decrease-key: remove the subtree rooted at the key to be decreased, replace the key with a smaller key, then merge the result back into the heap.
public merge(compare: Function, A: Node, B: Node): Node source
import merge from '@heap-data-structure/pairing-heap/src/merge.js'
Merge: compare the two root elements, the smaller remains the root of the result, the larger element and its subtree is appended as a child of this root.
/!\ Precondition:
- A != null and A.next = A.prev = null
- B != null and B.next = B.prev = null
public mergepairs(compare: Function, prev: Node): Node source
import mergepairs from '@heap-data-structure/pairing-heap/src/mergepairs.js'
Recursively builds a heap from an iterator of nodes by merging them pair by pair.
public prepend(A: Node, B: Node): Node source
import prepend from '@heap-data-structure/pairing-heap/src/prepend.js'
Set B as the first child of A.
/!\ Precondition:
- A != null
- B != null
- A.next = A.prev = B.next = B.prev = null