in DS
798 views
1 vote
1 vote
I have a confusion regarding the array implementation of binary tree ,i.e what are the index locations of the left child of a node whether it is 2i+1 or 2i and same for right child ,can anyone explain?
in DS
by
798 views

4 Comments

Ok got it
0
0
no need of heap, if it is complete binary tree, we can happily use array representation.
1
1
:)
0
0

1 Answer

2 votes
2 votes

Left child = 2i ,

right child = 2i+1

If array is start from index 1.

Related questions

1 vote
1 vote
2 answers
4