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

Method push

interview/heap.js:11–15  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

9 return this.arr.length-1
10 }
11 push(item){
12 // 新增元素
13 this.arr.push(item)
14 this.shiftUp(this.arr.length-1)
15 }
16 shiftUp(k){
17 let {arr,compare,parent} = this
18 while(k>1 && compare(arr[k],arr[parent(k)])){

Callers 15

threeSumFunction · 0.45
quickSortFunction · 0.45
asyncPoolFunction · 0.45
155.最小栈.jsFile · 0.45
printMatrixFunction · 0.45
findBottomLeftValueFunction · 0.45
nextGreaterElementFunction · 0.45
dfsFunction · 0.45
generateResumeFunction · 0.45
solutionFunction · 0.45

Calls 1

shiftUpMethod · 0.95

Tested by

no test coverage detected