A node of the weight balanced tree has

Category: QuestionsA node of the weight balanced tree has
Editor">Editor Staff asked 4 weeks ago

A node of the weight balanced tree has
 
(a) key, left and right pointers, size
 
(b) key, value
 
(c) key, size
 
(d) key
 
The doubt is from Weight Balanced Tree topic in section Binary Trees of Data Structures & Algorithms I
 
This question was addressed to me in an online interview.

1 Answers
Editor">Editor Staff answered 4 weeks ago

Correct option is (a) key, left and right pointers, size
 
Best explanation: As a weight balanced tree stores height of the subtrees, we need to use size as an additional attribute to every node. also value(for mappings) may be an optional attribute.