Question

Use induction, Prove that the height of the balanced BST is bounded by log(n).

Use induction,

Prove that the height of the balanced BST is bounded by log(n).

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Let us take the height of the binary tree is h.

Now, for the root level the number of nodes present is only the root node. So roots present is 1. (Level 0)

On the very next level down the roots the number of nodes present in a complete balanced BST is 2. (level 1)

Again for the next level no of nodes has to be 4. (level 2)

................

................

...............

...............

And the height being h, the number of nodes in the hth level = 2h

So now the total number of nodes present = 1+2+4+......+2h

=20+21+22+....+2h

=2(h+1) - 1

So now if we consider that there are n nodes in the balanced binary tree, then,

n = 2(h+1) - 1

or, n+1 = 2(h+1)

or, (n+1)/2 = 2h

or, h = log{(n+1)/2}

so, here we see that the height h is bounded by O(log(n)).

Add a comment
Know the answer?
Add Answer to:
Use induction, Prove that the height of the balanced BST is bounded by log(n).
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT