309 views
1 votes
1 votes

What is the location of parent node for any arbitrary node $i$ in an array implementation of a complete binary tree in C language?

  1. floor$(i /2)$
  2. floor$(i+1) /2$
  3. floor$((i-1)/2)$
  4. ceil$((i-1)/2)$

1 Answer

Best answer
5 votes
5 votes
In C language array index starts from $0.$ Parent of any node $i$ of a complete binary tree is given by floor$((i-1)/2).$
selected by
Answer:

Related questions

1 votes
1 votes
1 answer
2
gatecse asked Aug 9, 2020
113 views
Given an array of elements $5,7,9,1,3,10,8,4,$ which of the following is not a possible array implementation of min-heap of these elements?$1,3,4,7,5,8,9,10$$1,4,3,8,9,5,...
3 votes
3 votes
1 answer
3
gatecse asked Aug 9, 2020
227 views
The cut vertices in the given graph areE and FA, C and DC, E and FB and C
1 votes
1 votes
1 answer
4