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

Method getParentIndex

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

* @param {number} childIndex * @return {number}

(childIndex)

Source from the content-addressed store, hash-verified

39 * @return {number}
40 */
41 getParentIndex(childIndex) {
42 return Math.floor((childIndex - 1) / 2);
43 }
44
45 /**
46 * @param {number} childIndex

Callers 3

hasParentMethod · 0.95
parentMethod · 0.95
heapifyUpMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected