Skip to main content
Go to Latest
interface PriorityQueue
Re-export
import { type PriorityQueue } from "https://deno.land/x/masx200_leetcode_test@7.6.0/mod.ts";

Type Parameters

optional
T = any

Properties

clear: () => void

clear all elements

length: () => number

get length of elements

comparator: (a: T, b: T) => number

comparator Function used to determine the order of the elements. It is expected to return a negative value if the head argument is less than the second argument, zero if they're equal, and a positive value otherwise.

offer: (value: T) => void

add one element

head: () => T | undefined

get min element

tail: () => T | undefined

get max element

pop: () => T | undefined

get and delete max element

shift: () => T | undefined

get and delete min element

Methods

at(index: number): T | undefined
isEmpty(): boolean
toArray(): T[]
function PriorityQueue
Re-export
import { PriorityQueue } from "https://deno.land/x/masx200_leetcode_test@7.6.0/mod.ts";

comparator Function used to determine the order of the elements. It is expected to return a negative value if the head argument is less than the second argument, zero if they're equal, and a positive value otherwise.

Type Parameters

optional
T = any

Parameters

comparator: (a: T, b: T) => number
optional
values: T[]