MCPcopy Create free account
hub / github.com/course-dasheng/fe-algorithm / constructor

Method constructor

interview/heap.js:4–7  ·  view source on GitHub ↗
(compare)

Source from the content-addressed store, hash-verified

2// 长度是K的堆
3class Heap{
4 constructor(compare){
5 this.arr = [0] //忽略0这个索引
6 this.compare = compare?compare:(a,b)=>a>b
7 }
8 get size(){
9 return this.arr.length-1
10 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected