1.

If binary trees are represented in arrays, what formula can be used to locate a left child, if the node has an index i?(a) 2i+1(b) 2i+2(c) 2i(d) 4iQuestion is taken from Binary Trees topic in division Binary Trees of Data Structures & Algorithms II got this question during an internship interview.

Answer»

The correct option is (a) 2i+1

Easiest explanation - If binary TREES are REPRESENTED in ARRAYS, LEFT CHILDREN are located at indices 2i+1 and right children at 2i+2.



Discussion

No Comment Found

Related InterviewSolutions