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 right rotation at u, then these two quantities can be updated, in constant time, for all nodes affected by the rotation.
Answers
Answered by
15
Explanation:
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 right rotation at u, then these two quantities can be updated, in constant time, for all nodes affected by the rotation.
Similar questions
Political Science,
4 months ago
Science,
4 months ago
English,
9 months ago
Environmental Sciences,
1 year ago
Social Sciences,
1 year ago
English,
1 year ago