typescript-ds-lib
Version:
A collection of TypeScript data structure implementations
28 lines (27 loc) • 782 B
TypeScript
import { BaseCollection } from './base-collection';
import { Comparator } from '../types';
export interface PriorityQueue<T> {
push(element: T, priority: number): void;
pop(): T | undefined;
front(): T | undefined;
}
export declare class PriorityQueue<T> extends BaseCollection<T> implements PriorityQueue<T> {
private heap;
constructor(comparator?: Comparator<T>);
/**
* Checks if the queue is empty. Returns true if empty, false otherwise.
*/
isEmpty(): boolean;
/**
* Returns the number of elements in the queue.
*/
size(): number;
/**
* Removes all elements from the queue.
*/
clear(): void;
/**
* Checks if two priority queues are equal.
*/
equals(other: PriorityQueue<T>): boolean;
}