MCPcopy Create free account
hub / github.com/codemix/graph / bubbleUp

Method bubbleUp

packages/graph/src/Steps.ts:5001–5010  ·  view source on GitHub ↗
(index: number)

Source from the content-addressed store, hash-verified

4999 }
5000
5001 private bubbleUp(index: number): void {
5002 while (index > 0) {
5003 const parentIndex = Math.floor((index - 1) / 2);
5004 if (this.compareFn(this.heap[index]!, this.heap[parentIndex]!) >= 0) {
5005 break;
5006 }
5007 [this.heap[index], this.heap[parentIndex]] = [this.heap[parentIndex]!, this.heap[index]!];
5008 index = parentIndex;
5009 }
5010 }
5011
5012 private bubbleDown(index: number): void {
5013 while (true) {

Callers 1

pushMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected