GATEverse
← GATE CSE 2004

Q85

MCQ2 marks, −0.5

A program takes as input a balanced binary search tree with nn leaf nodes and computes the value of a function g(x)g(x) for each node xx. If the cost of computing g(x)g(x) is:

min⁡(number of leaf-nodesin left-subtree of x  ,  number of leaf-nodesin right-subtree of x)\Large \min \left ( \substack{\text{number of leaf-nodes}\\\text{in left-subtree of $x$}}\;,\; \substack{\text{number of leaf-nodes}\\\text{in right-subtree of $x$}}\right )

Then the worst-case time complexity of the program is?

Sign in to save attempts.

Loading…