MCPcopy Index your code
hub / github.com/trekhleb/javascript-algorithms / swap

Method swap

src/data-structures/heap/Heap.js:97–101  ·  view source on GitHub ↗

* @param {number} indexOne * @param {number} indexTwo

(indexOne, indexTwo)

Source from the content-addressed store, hash-verified

95 * @param {number} indexTwo
96 */
97 swap(indexOne, indexTwo) {
98 const tmp = this.heapContainer[indexTwo];
99 this.heapContainer[indexTwo] = this.heapContainer[indexOne];
100 this.heapContainer[indexOne] = tmp;
101 }
102
103 /**
104 * @return {*}

Callers 2

heapifyUpMethod · 0.95
heapifyDownMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected