If the tree is not a complete binary tree then what changes can be made for easy access of children of a node in the array?

Kim Trang

New member
If the tree is not a complete binary tree then what changes can be made for easy access of children of a node in the array?
A. every node stores data saying which of its children exist in the array
B. no need of any changes continue with 2w and 2w+1, if node is at i
C. keep a seperate table telling children of a node
D. use another array parallel to the array with tree
 
Answer: A
Explanation: Array cannot represent arbitrary shaped trees. It can only be used in case of complete trees. If every node stores data saying that which of its children exists in the array then elements can be accessed easily.
 

Tìm kiếm

Back
Top