Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/course-dasheng/fe-algorithm
/
Class
interview/heap.js:3–3 ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
1
// top K
2
// 长度是K的堆
3
class
Heap{
4
constructor(compare){
5
this.arr = [0]
//忽略0这个索引
6
this.compare = compare?compare:(a,b)=>a>b
Callers
nothing calls this directly
Calls
no outgoing calls
Tested by
no test coverage detected