edited by
976 views
1 votes
1 votes

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$
edited by

1 Answer

4 votes
4 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
Answer:

Related questions

1 votes
1 votes
2 answers
1
GO Classes asked Mar 26, 2023
770 views
Consider a min-heap with $6$ distinct elements. How many positions can be taken by $3^{\text{rd}}$ minimum element?$2$$3$$4$$5$