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

Function getParentPosition

Data-Structures/Heap/KeyPriorityQueue.js:22–22  ·  view source on GitHub ↗
(position)

Source from the content-addressed store, hash-verified

20
21// Priority Queue Helper functions
22const getParentPosition = (position) => Math.floor((position - 1) / 2)
23const getChildrenPositions = (position) => [2 * position + 1, 2 * position + 2]
24
25class KeyPriorityQueue {

Callers 2

updateMethod · 0.85
_shiftUpMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected