Addressable Binary Heaps - v1.3.0
    Preparing search index...

    Function increase

    • Increases the key value of a heap element by a specified amount. The element is rebalanced in whichever direction the new key requires, so a negative amount is handled the same as a positive one.

      Type Parameters

      • H extends IHeapArray

        The type of min-heap array.

      Parameters

      • instance: H

        The min-heap instance.

      • node: H[number]

        The element to modify.

      • increaseValue: number

        Amount to increase the key by.

      Returns boolean

      true if element was found and modified, false if the heap does not hold it, the amount is not a number, or the new key would be NaN (key is then unchanged).

      TypeError if node.key is not writable, as on a frozen node or a key with a getter and no setter. The heap and key are then unchanged.