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

Method swap

interview/heap.js:59–61  ·  view source on GitHub ↗
(i,j)

Source from the content-addressed store, hash-verified

57 return Math.floor(k/2)
58 }
59 swap(i,j){
60 [this.arr[i],this.arr[j]] = [this.arr[j],this.arr[i]]
61 }
62}
63
64let heap = new Heap((a,b)=>a>b) //大顶堆

Callers 3

shiftUpMethod · 0.95
popMethod · 0.95
sinkDownMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected