Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
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
22
const
getParentPosition = (position) => Math.floor((position - 1) / 2)
23
const
getChildrenPositions = (position) => [2 * position + 1, 2 * position + 2]
24
25
class
KeyPriorityQueue {
Callers
2
update
Method · 0.85
_shiftUp
Method · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected