79.9k views
4 votes
Consider a node R of a complete binary tree whose value is stored in position i of an array representation for the tree. If R has a left child, where will the left child's position be in the array?

a. 2∗i+2
b. i+2
c. i+1
d. None of the above

1 Answer

5 votes

Final answer:

In a complete binary tree represented as an array, the left child of a node at position i is at position 2*i + 1. Therefore, the correct answer is c. i + 1.

Step-by-step explanation:

If we consider a complete binary tree represented as an array, the index of any node R in the array is given as i. The positions of its children can be determined using specific formulas. The position of the left child is given by 2*i + 1, which means that for a node located at position i, its left child will be located at position 2*i + 1 in the array. Thus, the correct answer is c. i + 1.

User Yotam Omer
by
8.1k points