MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / #swap

Method #swap

Data-Structures/Heap/BinaryHeap.js:127–132  ·  view source on GitHub ↗

* Swaps elements at two specified indices in the heap. * @param {number} index1 - The index of the first element to be swapped. * @param {number} index2 - The index of the second element to be swapped. * @private

(index1, index2)

Source from the content-addressed store, hash-verified

125 * @private
126 */
127 #swap(index1, index2) {
128 ;[this.heap[index1], this.heap[index2]] = [
129 this.heap[index2],
130 this.heap[index1]
131 ]
132 }
133}
134
135/**

Callers 2

#bubbleUpMethod · 0.95
#sinkDownMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected