Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started