MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / _swap

Method _swap

Data-Structures/Heap/KeyPriorityQueue.js:148–154  ·  view source on GitHub ↗
(position1, position2)

Source from the content-addressed store, hash-verified

146 }
147
148 _swap(position1, position2) {
149 // Helper function to swap 2 nodes
150 ;[this._heap[position1], this._heap[position2]] = [
151 this._heap[position2],
152 this._heap[position1]
153 ]
154 }
155}
156
157export { KeyPriorityQueue }

Callers 3

popMethod · 0.95
_shiftUpMethod · 0.95
_shiftDownMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected