Home Manual Reference Source
public class | source

PairingHeap

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

compare: *

public

min: *

Method Summary

Public Methods
public

decreasekey(ref: Node, value: Object)

Decrease-key

public

delete(ref: *)

Ref must be internal ref.prev and ref.next get reset to null

public

head(): *

Find-min: simply return the top element of the heap.

public
public

increasekey(ref: Node, value: Object)

Increase-key: remove the item at the key to be increased, replace the key with a larger key, then push the result back into the heap.

public

merge(other: *)

Supposes the same comparison function is used in both trees.

public

pop(): *

Delete-min: remove the root and merge its subtrees.

public
public

push(value: *): *

Insert: create a new heap for the inserted element and merge into the original heap.

public

pushreference(ref: *): *

/!\ ref.next = ref.prev = null which means all references that are external to the tree must reset .next and .prev and one must not call PairingHeap#pushreference with an internal reference from this tree or another, except the root of another tree.

public

update(ref: Node, value: Object)

Public Constructors

public constructor() source

Public Members

public compare: * source

public min: * source

Public Methods

public decreasekey(ref: Node, value: Object) source

Decrease-key

Params:

NameTypeAttributeDescription
ref Node

Non-null internal node object.

value Object

The new value for ref.

public delete(ref: *) source

Ref must be internal ref.prev and ref.next get reset to null

Params:

NameTypeAttributeDescription
ref *

public head(): * source

Find-min: simply return the top element of the heap.

Return:

*

public headreference(): * source

Return:

*

public increasekey(ref: Node, value: Object) source

Increase-key: remove the item at the key to be increased, replace the key with a larger key, then push the result back into the heap.

Params:

NameTypeAttributeDescription
ref Node

Non-null internal node object.

value Object

The new value for ref.

public merge(other: *) source

Supposes the same comparison function is used in both trees. We can call pushreference since other.min.next = other.min.prev = null.

Params:

NameTypeAttributeDescription
other *

public pop(): * source

Delete-min: remove the root and merge its subtrees. Various strategies are employed.

Return:

*

public popreference(): * source

Return:

*

public push(value: *): * source

Insert: create a new heap for the inserted element and merge into the original heap.

Params:

NameTypeAttributeDescription
value *

Return:

*

public pushreference(ref: *): * source

/!\ ref.next = ref.prev = null which means all references that are external to the tree must reset .next and .prev and one must not call PairingHeap#pushreference with an internal reference from this tree or another, except the root of another tree.

Params:

NameTypeAttributeDescription
ref *

Return:

*

public update(ref: Node, value: Object) source

Params:

NameTypeAttributeDescription
ref Node

Non-null internal node object.

value Object

The new value for ref.