/** * 大小堆(优先队列) */ /** * return a negative value if a < b, 0 if a == b, a positive value if a > b */ export type Comparator = (a: K, b: K) => number; interface HeapOptions { /** * A function that defines the sort order. The return value should be a number whose sign * indicates the relative order of the two elements: negative if a is less than b, * positive if a is greater than b, and zero if they are equal. * NaN is treated as 0. */ comparator: Comparator; } export declare class Heap { private readonly elements; size: number; private cmp; constructor(options: HeapOptions); peek(): T; pop(): T | undefined; add(data: T): void; toArray(): Array; private _float; private _sink; private swap; } export {}; //# sourceMappingURL=heap.d.ts.map