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

Method push

interview/502.ipo.js:24–28  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

22 return this.arr.length-1
23 }
24 push(item){
25 // 新增元素
26 this.arr.push(item)
27 this.shiftUp(this.arr.length-1)
28 }
29 shiftUp(k){
30 let {arr,compare,parent} = this
31 while(k>1 && compare(arr[k],arr[parent(k)])){

Callers 1

findMaximizedCapitalFunction · 0.95

Calls 1

shiftUpMethod · 0.95

Tested by

no test coverage detected