Home Manual Reference Source Test

Function

Static Public Summary
public

DAryHeap(arity: *, compare: *)

public

DAryHeapWithoutReferences(arity: *, compare: *)

public

makeheap(arity: int, compare: function, swap: function, a: array, i: int, j: int)

Builds a heap in O(n) operations.

public

merge(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int)

Merges heaps at intervals [i, j[ and [j, k[ in array a into a new heap at interval [i, k[.

public

nextchild(arity: int, compare: function, swap: function, a: array, i: int, j: int): *

Computes which child is the smallest according to a comparison function.

public

pop(arity: int, compare: function, swap: function, a: array, i: int, j: int): *

Pops the root from a d-ary heap.

public

pull(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int)

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): *

Inserts the jth element of an array in an existing dary heap in interval [i, j[.

public

remove(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int): *

Removes a target element from a d-ary heap.

public

siftdown(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int): *

Sifts down a node.

public

siftup(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int): *

Sifts up a node.

public

* sorted(arity: *, compare: *, swap: *, a: *, i: *, j: *)

Static Public

public DAryHeap(arity: *, compare: *) source

Params:

NameTypeAttributeDescription
arity *
compare *

public DAryHeapWithoutReferences(arity: *, compare: *) source

Params:

NameTypeAttributeDescription
arity *
compare *

public makeheap(arity: int, compare: function, swap: function, a: array, i: int, j: int) source

Builds a heap in O(n) operations.

Params:

NameTypeAttributeDescription
arity int

arity of the heap

compare function

the comparison function

swap function

the swap function

a array

the array where the heap is stored

i int

left inner bound

j int

right outer bound

public merge(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int) source

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:

NameTypeAttributeDescription
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

Computes which child is the smallest according to a comparison function.

Hypothesis : i < j i.e. there should be at least one child

Params:

NameTypeAttributeDescription
arity int

arity of the heap

compare function

the comparison function

swap function

the swap function

a array

the array where the heap is stored

i int

is the first child

j int

1 is the last leaf

Return:

*

public pop(arity: int, compare: function, swap: function, a: array, i: int, j: int): * source

Pops the root from a d-ary heap.

Hypothesis : i < j

Params:

NameTypeAttributeDescription
arity int

arity of the heap

compare function

the comparison function

swap function

the swap function

a array

the array where the heap is stored

i int

is the root

j int

1 is the last leaf

Return:

*

public pull(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int) source

Sifts a node up to the root as if its priority was the highest.

Params:

NameTypeAttributeDescription
arity int

arity of the heap

compare function

the comparison function

swap function

the swap function

a array

the array where the heap is stored

i int

is the root element

j int

1 is the last leaf

k int

is the target node

public push(arity: int, compare: function, swap: function, a: array, i: int, j: int): * source

Inserts the jth element of an array in an existing dary heap in interval [i, j[.

Hypothesis : i <= j

Params:

NameTypeAttributeDescription
arity int

arity of the heap

compare function

the comparison function

swap function

the swap function

a array

the array where the heap is stored

i int

is the root

j int

1 is the new leaf

Return:

*

public remove(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int): * source

Removes a target element from a d-ary heap.

Hypothesis : i < j

Params:

NameTypeAttributeDescription
arity int

arity of the heap

compare function

the comparison function

swap function

the swap function

a array

the array where the heap is stored

i int

is the root

j int

1 is the last leaf

k int

is the target node

Return:

*

public siftdown(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int): * source

Sifts down a node.

Params:

NameTypeAttributeDescription
arity int

arity of the heap

compare function

the comparison function

swap function

the swap function

a array

the array where the heap is stored

i int

is the root element

j int

1 is the last leaf

k int

is the target node

Return:

*

public siftup(arity: int, compare: function, swap: function, a: array, i: int, j: int, k: int): * source

Sifts up a node.

Params:

NameTypeAttributeDescription
arity int

arity of the heap

compare function

the comparison function

swap function

the swap function

a array

the array where the heap is stored

i int

is the root element

j int

1 is the last leaf

k int

is the target node

Return:

*

public * sorted(arity: *, compare: *, swap: *, a: *, i: *, j: *) source

Params:

NameTypeAttributeDescription
arity *
compare *
swap *
a *
i *
j *