We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
There is typo in array -> binary tree calculation. Should be:
parent(i) = Math.ceil(i / 2 - 1)leftChild(i) = 2 * i + 1rightChild(i) = 2 * i + 2
There is typo in array -> binary tree calculation. Should be:
parent(i) = Math.ceil(i / 2 - 1)
leftChild(i) = 2 * i + 1
rightChild(i) = 2 * i + 2