Question: Need help with this Algorithms problem Problem 2: Consider a binary search tree augmented with the following information. At each node z we also store
Need help with this Algorithms problem
Problem 2: Consider a binary search tree augmented with the following information. At each node z we also store m(x): the number of nodes in the subtree rooted at x (including x). We require that for every node x in the tree |m(L(x))- m(R(x)1. Prove that h O(logn) where h is the height of a tree with n nodes satisfying this property [ Show however that this condition is too strict and that maintaining will force certain insertion and dele- tion operations to cost (log n) (build an example where insertion or deletion require many rotations to fix the tree) Problem 2: Consider a binary search tree augmented with the following information. At each node z we also store m(x): the number of nodes in the subtree rooted at x (including x). We require that for every node x in the tree |m(L(x))- m(R(x)1. Prove that h O(logn) where h is the height of a tree with n nodes satisfying this property [ Show however that this condition is too strict and that maintaining will force certain insertion and dele- tion operations to cost (log n) (build an example where insertion or deletion require many rotations to fix the tree)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
