Answered step by step
Verified Expert Solution
Link Copied!

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 ITI

image text in transcribed

Problem 3. (12 marks) Recall that in a binary tree each node has at most 2 children. Suppose T is a binary tree with ITI = n (ie, has n nodes). For every node u we use Lu and Ru to denote the left subtree and right subtree of v, respectively. We say the subtree rooted at v is nearly balanced if IRl/L| 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 log nl Problem 3. (12 marks) Recall that in a binary tree each node has at most 2 children. Suppose T is a binary tree with ITI = n (ie, has n nodes). For every node u we use Lu and Ru to denote the left subtree and right subtree of v, respectively. We say the subtree rooted at v is nearly balanced if IRl/L| 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 log nl

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

Students also viewed these Databases questions