[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Data Structures :: Trees - Discussion

Home > Data Structures > Trees > MCQs Questions Discussion

13 / 194

Choose the correct option.

B Trees are generally

Avery deep and narrow

Bvery wide and shallow

Cvery deep and very wide

Dcannot say

Answer: Option (Login/Signup)

Show Explanation

Please explain following binary search tree case study



Suppose that a binary search tree stores, at each node, u, the height, u.height, of the subtree rooted at u, and the size, u.size of the subtree rooted at u.





1. Show how, if we perform a left rotation at u, then these two quantities can be updated, in constant time, for all nodes affected by the rotation.





2. Show how, if we perform a right rotation at u, then these two quantities can be updated, in constant time, for all nodes affected by the rotation.



3. Explain why the same result is not possible if we try to also store the depth, u.depth, of each node u.

Asked In ::

Post Your Answer Here:     

Reply    
Rate This: +8 -1 +4
    Report


Report Error

Please Login First Click Here

Reply    
Rate This: +0 -3 +
    Report


Report Error

Please Login First Click Here