If binary trees are represented in arrays, what formula can be used to locate a left child, if the node has an index i?

Q & ACategory: Data StructureIf binary trees are represented in arrays, what formula can be used to locate a left child, if the node has an index i?
Admin Staff asked 4 years ago

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) 4i

1 Answers
Admin Staff answered 4 years ago

a) 2i+1