Skip to content

Instantly share code, notes, and snippets.

@nerohoop
Created January 8, 2018 02:36
Show Gist options
  • Save nerohoop/f01e8b3e74705eed1b2c6d65c92feb63 to your computer and use it in GitHub Desktop.
Save nerohoop/f01e8b3e74705eed1b2c6d65c92feb63 to your computer and use it in GitHub Desktop.
The root element will be at Arr[0].
Below table shows indexes of other nodes for the ith node, i.e., Arr[i]:
Arr[i/2] Returns the parent node
Arr[(2*i)+1] Returns the left child node
Arr[(2*i)+2] Returns the right child node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment