in DS edited by
820 views
1 vote
1 vote

In an array-based implementation of a Heap, the right-child of the right-child of the node at index $i,$ if it exists, can be found at what array location? Index of the array starts from $1.$

  1. $4i + 3$
  2. $2i + 1$
  3. $4i + 1$
  4. $2i + 2$
in DS edited by
820 views

1 Answer

3 votes
3 votes
Right child of A[i]  will be at A[2i+1]   // because index start from 1

so right child of (2i+1) will be at 2(2i+1) + 1 = 4i + 3

 

Correct Answer is A