Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

parent of heap node

let k = index you are looking at


parent = (k - 1) // 2 # floor division

leftChild = 2 * k + 1

rightChild = 2 * k + 2
 
PREVIOUS NEXT
Tagged: #parent #heap #node
ADD COMMENT
Topic
Name
4+9 =