Open In App

Data Structures | Binary Trees | Question 9

Like Article
Like
Save
Share
Report

A weight-balanced tree is a binary tree in which for each node. The number of nodes in the left sub tree is at least half and at most twice the number of nodes in the right sub tree. The maximum possible height (number of nodes on the path from the root to the farthest leaf) of such a tree on n nodes is best described by which of the following? a) \\log_2 n b) \\log_{4/3} n c) \\log_3 n d) \\log_{3/2} n

(A)

A

(B)

B

(C)

C

(D)

D



Answer: (D)

Explanation:

A weight-balanced tree is a binary tree where the number of nodes in the left subtree is at least half and at most twice the number of nodes in the right subtree for each node. To determine the maximum possible height of such a tree on n nodes, let’s analyze the options:

a)  This represents the height of a perfectly balanced binary tree. In a weight-balanced tree, the left subtree can have at most twice the number of nodes in the right subtree, so it won’t necessarily be perfectly balanced. Therefore, option a is not the best description.

b)This option seems to be a non-standard logarithmic base. It’s not a common logarithmic base used in tree height analysis. It is not a typical representation for the height of a binary tree.

c) This represents the height of a perfectly balanced ternary tree. Similar to option a, this doesn’t consider the constraints of a weight-balanced tree.

d)  This option is interesting because it suggests a growth factor in the number of nodes in the left subtree compared to the right subtree. It is a non-standard base but seems to reflect the constraints of a weight-balanced tree.

In a weight-balanced tree, the number of nodes in the left subtree is at least half and at most twice the number of nodes in the right subtree. Therefore, option (d) is the best description of the maximum possible height of a weight-balanced tree on n nodes.


Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads