import { Heap } from './heap'; export type MinHeapCompareFn = (a: T, b: T) => number; /** * @license MIT * @copyright 2024 Thinh Trinh Duc * * @class */ export declare class MinHeap { #private; /** * * @param values New elements to add to the Heap. * @param compareFn Function used to determine the order of the elements. It is expected to return a positive value if the first argument is less than the second argument, zero if they're equal, and a negative value otherwise. */ constructor(values?: T[], compareFn?: MinHeapCompareFn); get size(): number; get min(): T; /** * * @param values New elements to add to the Heap. * @param compareFn Function used to determine the order of the elements. It is expected to return a positive value if the first argument is less than the second argument, zero if they're equal, and a negative value otherwise. */ static fromArray(values?: T[], compareFn?: MinHeapCompareFn): MinHeap; /** * Get left child's index of the provided index. * @param i index of the node */ static getLeftChildIndex(i: number): number; /** * Get right child's index of the provided index. * @param i index of the node */ static getRightChildIndex(i: number): number; /** * Get parent's index of the provided index. * @param i index of the node */ static getParentIndex(i: number): number; /** * Inserts new elements to the Heap. * if only single value is add the complexity is log(N) * otherwise the complexity is log(N) * @param values New elements to add to the Heap. */ insert(...values: T[]): Heap; /** * Checks if an array is a valid heap. */ isValid(i?: number): boolean; /** * Remove the max element of a heap and returns it * Return `undefined` if heap is empty. */ extractMin(): T | undefined; toArray(): T[]; } //# sourceMappingURL=min-heap.d.ts.map