Function
Static Public Summary | ||
public |
DAryHeap(arity: *, compare: *) |
|
public |
DAryHeapWithoutReferences(arity: *, compare: *) |
|
public |
Builds a heap in O(n) operations. |
|
public |
Merges heaps at intervals [i, j[ and [j, k[ in array a into a new heap at interval [i, k[. |
|
public |
Computes which child is the smallest according to a comparison function. |
|
public |
Pops the root from a d-ary heap. |
|
public |
Sifts a node up to the root as if its priority was the highest. |
|
public |
Inserts the jth element of an array in an existing dary heap in interval [i, j[. |
|
public |
Removes a target element from a d-ary heap. |
|
public |
Sifts down a node. |
|
public |
Sifts up a node. |
|
public |
* sorted(arity: *, compare: *, swap: *, a: *, i: *, j: *) |
Static Public
public DAryHeap(arity: *, compare: *) source
import DAryHeap from '@heap-data-structure/d-ary-heap/src/adt/DAryHeap.js'
Params:
Name | Type | Attribute | Description |
arity | * | ||
compare | * |
public DAryHeapWithoutReferences(arity: *, compare: *) source
import DAryHeapWithoutReferences from '@heap-data-structure/d-ary-heap/src/adt/DAryHeapWithoutReferences.js'
Params:
Name | Type | Attribute | Description |
arity | * | ||
compare | * |
public makeheap(arity: int, compare: function, swap: function, a: array, i: int, j: int) source
import makeheap from '@heap-data-structure/d-ary-heap/src/core/makeheap.js'
Builds a heap in O(n) operations.
public merge(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int) source
import merge from '@heap-data-structure/d-ary-heap/src/core/merge.js'
Merges heaps at intervals [i, j[ and [j, k[ in array a into a new heap at interval [i, k[.
Hypothesis :
- i <= j <= k
- j - 1 is the last leaf ot the first heap
Params:
Name | Type | Attribute | Description |
arity | int | arity of the heap |
|
compare | function | the comparison function |
|
swap | function | the swap function |
|
a | array | the array where the two heaps are stored |
|
i | int | is the root of the first heap |
|
j | int | is the root of the second heap |
|
k | int | 1 is the index of the last leaf in the second heap |
public nextchild(arity: int, compare: function, swap: function, a: array, i: int, j: int): * source
import nextchild from '@heap-data-structure/d-ary-heap/src/core/nextchild.js'
Computes which child is the smallest according to a comparison function.
Hypothesis : i < j i.e. there should be at least one child
Return:
* |
public pop(arity: int, compare: function, swap: function, a: array, i: int, j: int): * source
import pop from '@heap-data-structure/d-ary-heap/src/core/pop.js'
Pops the root from a d-ary heap.
Hypothesis : i < j
Return:
* |
public pull(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int) source
import pull from '@heap-data-structure/d-ary-heap/src/core/pull.js'
Sifts a node up to the root as if its priority was the highest.
public push(arity: int, compare: function, swap: function, a: array, i: int, j: int): * source
import push from '@heap-data-structure/d-ary-heap/src/core/push.js'
Inserts the jth element of an array in an existing dary heap in interval [i, j[.
Hypothesis : i <= j
Return:
* |
public remove(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int): * source
import remove from '@heap-data-structure/d-ary-heap/src/core/remove.js'
Removes a target element from a d-ary heap.
Hypothesis : i < j
Return:
* |
public siftdown(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int): * source
import siftdown from '@heap-data-structure/d-ary-heap/src/core/siftdown.js'
Sifts down a node.
Return:
* |
public siftup(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int): * source
import siftup from '@heap-data-structure/d-ary-heap/src/core/siftup.js'
Sifts up a node.
Return:
* |
public * sorted(arity: *, compare: *, swap: *, a: *, i: *, j: *) source
import sorted from '@heap-data-structure/d-ary-heap/src/core/sorted.js'
Params:
Name | Type | Attribute | Description |
arity | * | ||
compare | * | ||
swap | * | ||
a | * | ||
i | * | ||
j | * |