Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/node-core-library > MinimumHeap > (constructor)

MinimumHeap.(constructor)

Constructs a new MinimumHeap instance.

Signature:

constructor(comparator: (a: T, b: T) => number);

Parameters

Parameter

Type

Description

comparator

(a: T, b: T) => number

a comparator function that determines the order of the items in the heap. If the comparator returns a value less than zero, then a will be considered less than b. If the comparator returns zero, then a and b are considered equal. Otherwise, a will be considered greater than b.