priority-queue-with-custom-comparator
Version:
Priority queue data structure where you are able to set your own compare function.
17 lines (16 loc) • 444 B
TypeScript
export declare type PriorityQueueComparator<T> = (a: T, b: T) => boolean;
export interface IPriorityQueueOptions<T> {
comparator: PriorityQueueComparator<T>;
initialElements?: T[];
}
export interface IPriorityQueue<T> {
size(): number;
isEmpty(): boolean;
peek(): T;
push(value: T): void;
pushMany(values: T[]): void;
pop(): T;
clear(): void;
has(value: T): boolean;
values(): T[];
}