Question: why for a is it 2 ^ h - 1 - 1 and not n - 1 . n being the nb of nodes? Say

why for a is it 2^h-1-1 and not n-1. n being the nb of nodes? Say we have our worst case full binary tree where the root has 2 children, the right child is a leaf and the left one again has 2 children, the right one there is also a leaf, and the left has 2 children that are both leaves. in this case, let v be a node in the tree. for each internal node, the left subtree contains all the leaves and the rught subtree has none, or is just a leaf. If the imbalance(v) is abs(left subtree - right), would it not be (n-1)-0 as there are 0 nodes on the right? so the upper bound would be n-1?

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 Programming Questions!