Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions src/maxHeap.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,12 @@ export interface IGetCompareValue<T> {
(value: T): number | string;
}

export class MaxHeap<T> implements Iterable<T> {
constructor(getCompareValue?: IGetCompareValue<T>, _heap?: Heap<T>);
toArray(): T[];
[Symbol.iterator](): Iterator<T, any, undefined>;
export class MaxHeap<T> extends Heap<T> {
constructor(getCompareValue?: IGetCompareValue<T>, values?: T[]);
insert(value: T): MaxHeap<T>;
push(value: T): MaxHeap<T>;
extractRoot(): T | null;
pop(): T | null;
sort(): T[];
fix(): MaxHeap<T>;
isValid(): boolean;
clone(): MaxHeap<T>;
root(): T | null;
top(): T | null;
leaf(): T | null;
size(): number;
isEmpty(): boolean;
clear(): void;
static heapify<T>(
values: T[],
getCompareValue?: IGetCompareValue<T>
Expand Down
16 changes: 2 additions & 14 deletions src/minHeap.d.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
import { Heap } from "./heap";
import { IGetCompareValue } from "./maxHeap";

export class MinHeap<T> implements Iterable<T> {
constructor(getCompareValue?: IGetCompareValue<T>, _heap?: Heap<T>);
toArray(): T[];
[Symbol.iterator](): Iterator<T, any, undefined>;
export class MinHeap<T> extends Heap<T> {
constructor(getCompareValue?: IGetCompareValue<T>, values?: T[]);
insert(value: T): MinHeap<T>;
push(value: T): MinHeap<T>;
extractRoot(): T | null;
pop(): T | null;
sort(): T[];
fix(): MinHeap<T>;
isValid(): boolean;
clone(): MinHeap<T>;
root(): T | null;
top(): T | null;
leaf(): T | null;
size(): number;
isEmpty(): boolean;
clear(): void;
static heapify<T>(
values: T[],
getCompareValue?: IGetCompareValue<T>
Expand Down