Class FibonacciHeap<E>

Fibonacci heap (min-heap) optimized for fast merges and amortized operations.

Time O(1), Space O(1)

examples will be generated by unit test

Type Parameters

  • E

Constructors

  • Create a FibonacciHeap.

    Type Parameters

    • E

    Parameters

    • Optionalcomparator: Comparator<E>

      Comparator to order elements (min-heap by default).

    Returns FibonacciHeap<E>

    New FibonacciHeap instance.

    Time O(1), Space O(1)

Accessors

Methods

  • Meld another heap into this heap.

    Parameters

    • heapToMerge: FibonacciHeap<E>

      Another FibonacciHeap to meld into this one.

    Returns void

    void

    Time O(1), Space O(1)

  • Remove and return the minimum element, consolidating the root list.

    Returns undefined | E

    Minimum element or undefined.

    Time O(log N) amortized, Space O(1)

  • Push an element into the root list.

    Parameters

    • element: E

      Element to insert.

    Returns this

    This heap.

    Time O(1) amortized, Space O(1)