Optional
comparator: Comparator<E>The comparator
parameter is an optional argument that represents a
function used to compare elements in the FibonacciHeap. If a comparator function is provided, it
will be used to determine the order of elements in the heap. If no comparator function is
provided, a default comparator function will be used.
The function returns the minimum node in a Fibonacci heap.
The method is returning the minimum node of the Fibonacci heap, which is of type
FibonacciHeapNode<E>
. If there is no minimum node, it will return undefined
.
The function returns the root node of a Fibonacci heap.
The method is returning either a FibonacciHeapNode object or undefined.
The function returns the size of an object.
The size of the object, which is a number.
Protected
_consolidateProtected
_defaultProtected
_linkProtected
Time Complexity: O(1) Space Complexity: O(1)
Remove and return the top element (the smallest or largest element) from the heap.
Time Complexity: O(1) Space Complexity: O(1)
Insert an element into the heap and maintain the heap properties.
FibonacciHeap
Protected
consumeProtected
Time Complexity: O(n), where n is the number of elements in the linked list. Space Complexity: O(1)
Get the size (number of elements) of the heap.
Optional
head: FibonacciHeapNode<E>The head of the linked list.
FibonacciHeapNode
Protected
createProtected
Create a new node.
Time Complexity: O(1) Space Complexity: O(1)
merge two heaps. The heap that is merged will be cleared. The heap that is merged into will remain.
Time Complexity: O(1) Space Complexity: O(1)
Protected
mergeTime Complexity: O(1) Space Complexity: O(1)
Merge the given node with the root list.
The node to be merged.
Protected
peekTime Complexity: O(1) Space Complexity: O(1)
Insert an element into the heap and maintain the heap properties.
FibonacciHeap
Protected
removeProtected
Time Complexity: O(1) Space Complexity: O(1)
Remove and return the top element (the smallest or largest element) from the heap.
The node to be removed.
The constructor function initializes a FibonacciHeap object with an optional comparator function.