(index: number)
| 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) { |