A binary heap.

Type Parameters

  • T

Implements

Constructors

Properties

Accessors

Methods

Constructors

  • Type Parameters

    • T

    Parameters

    • Optional items: Iterable<T>

      Initial elements for this heap.

    • compare: ((lhs, rhs) => number) = defaultCompare

      The compare function to order elements.

        • (lhs, rhs): number
        • The compare function to order elements.

          Parameters

          • lhs: T
          • rhs: T

          Returns number

    • heapify: boolean = true

      Whether to heapify the initial elements. Set this to false if elements are already in heap order.

    Returns BinaryHeap<T>

Properties

compare: ((lhs, rhs) => number) = defaultCompare

Type declaration

    • (lhs, rhs): number
    • The compare function to order elements.

      Parameters

      • lhs: T
      • rhs: T

      Returns number

heap: T[]

Accessors

Methods

Generated using TypeDoc