MCPcopy
hub / github.com/CodebuffAI/codebuff / siftUp

Method siftUp

common/src/util/min-heap.ts:25–34  ·  view source on GitHub ↗
(index: number)

Source from the content-addressed store, hash-verified

23 }
24
25 private siftUp(index: number): void {
26 while (index > 0) {
27 const parentIndex = this.getParentIndex(index)
28 if (this.heap[parentIndex].score <= this.heap[index].score) {
29 break
30 }
31 this.swap(index, parentIndex)
32 index = parentIndex
33 }
34 }
35
36 private siftDown(index: number): void {
37 while (true) {

Callers 1

insertMethod · 0.95

Calls 2

getParentIndexMethod · 0.95
swapMethod · 0.95

Tested by

no test coverage detected