Question: Problem 3. (12 marks) Recall that in a binary tree each node has at most 2 children. Suppose T is a binary tree with T-n

 Problem 3. (12 marks) Recall that in a binary tree each

Problem 3. (12 marks) Recall that in a binary tree each node has at most 2 children. Suppose T is a binary tree with T-n (i.e. has n nodes). For every node v we use L and R, to denote the left subtree and right subtree of u, respectively. We say the subtree rooted at u is nearly balanced if Ru / Lu 2 i.e. the sizes of the two subtrees are within a factor two of each other a. (5 marks) Suppose that the root of T is nearly balanced. What is the maximum height of T in terms of n? Explain why. b. (7 marks) We say the whole tree is nearly balanced if for every node v of T, the subtree rooted at v is nearly balanced. Denote h as the height of T. Show that if T is nearly balanced then h e O(log n) by first showing that h 1083 n1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!