📜  堆节点的父节点 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:47.892000             🧑  作者: Mango

代码示例1
let k = index you are looking at


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

leftChild = 2 * k + 1

rightChild = 2 * k + 2