Class Heap<T>

A Collection is an iterable Container type. This is an abstract base class for user-defined collection types.

Abstract

Implements

Type Parameters

  • T

Hierarchy

Constructors

Accessors

Methods

Constructors

  • Initializes a new Heap instance.

    Note: When constructing the heap from an array, it will operate directly on this array. For other iterables, it will create a new array.

    Type Parameters

    • T

    Parameters

    • Optional container: Iterable<T> = []

      The initial values.

    • Optional cmp: Comparer<any> = compare

      Compare function. Defaults to smaller values first.

    Returns Heap<T>

Accessors

  • get size(): number
  • Returns the total number of elements in the collection.

    Returns number

Methods

  • Remove specified item from heap.

    Returns

    true if the item was removed.

    Parameters

    • item: T

      The item want to remove.

    Returns boolean

  • Returns an iterable with all the values in the heap.

    Returns

    The values in the heap.

    Returns IterableIterator<T>

Generated using TypeDoc