bst-typed
Version:
Binary Search Tree
28 lines (27 loc) • 1.22 kB
TypeScript
/**
* data-structure-typed
*
* @author Kirk Qi
* @copyright Copyright (c) 2022 Kirk Qi <qilinaus@gmail.com>
* @license MIT License
*/
import type { PriorityQueueOptions } from '../../types';
import { PriorityQueue } from './priority-queue';
/**
* Max-oriented priority queue (max-heap) built on {@link PriorityQueue}.
* The default comparator orders primitive values in descending order. If you store objects,
* you must provide a custom comparator via {@link PriorityQueueOptions}.
* @template E Element type stored in the queue.
* @template R Extra record/metadata associated with each element.
* @example
*/
export declare class MaxPriorityQueue<E = any, R = any> extends PriorityQueue<E, R> {
/**
* Creates a max-priority queue.
* @param elements Optional initial elements to insert.
* @param options Optional configuration (e.g., `comparator`, `toElementFn`).
* @throws {TypeError} Thrown when using the default comparator with object elements (provide a custom comparator).
* @remarks Complexity — Time: O(n log n) when inserting n elements incrementally; Space: O(n).
*/
constructor(elements?: Iterable<E> | Iterable<R>, options?: PriorityQueueOptions<E, R>);
}