Consider a weight balanced tree such that, the number of nodes in the left sub tree is at least half and at most twice the number of nodes in the right sub tree. The maximum possible height (number of nodes on the path from the root to the farthest leaf) of such a tree on k nodes can be described as
(a) log2 n
(b) log4/3 n
(c) log3 n
(d) log3/2 n
The above asked question is from Weight Balanced Tree in section Binary Trees of Data Structures & Algorithms I
I got this question by my college director while I was bunking the class.
Right option is (d) log3/2 n
Best explanation: Total number of nodes can be described by the recurrence T(n) = T((n-1)/3)) + T(2(n-1)/3) + 1 T(1) = 1. height of the tree will be H(n) = H(2/3(n-1)) + 1, H(1). drawing a recurrence tree and the cost at each level is 1 and the height will be log(3/2)n.