UNPKG

ts-ds-tool

Version:

Data structure and algorithm of TypeScript

14 lines (13 loc) 269 B
import { Heap } from "./Heap"; export class MaxHeap extends Heap { constructor(key) { super(); this.key = key; } compare(a, b) { if (this.key) { return a[this.key] >= b[this.key]; } return a >= b; } }