GATE CSE
First time here? Checkout the FAQ!
x
+1 vote
28 views
Why is $n \leq 2^{h+1} - 1$ equivalent to $h \geq \log_2{\frac{n+1}{2}}$ ? This is applicable to Binary Trees
asked ago in Graph Theory by (269 points)   | 28 views

1 Answer

0 votes

This is a basic concept for calculating minimum height for Binary Trees.

Hope you know A Complete Binary tree corresponds to maximum possible number of nodes in any tree.

When Nodes are maximum (Fully dense tree) then this also corresponds to minimum hight of the tree.

Now lets derive the formula

At level 0 Number of nodes possible --------->>>>> 1 (Root)     // 20

At level 1 Number of nodes possible--------->>>>>2                 //  21

At level 2 Number of nodes possible--------->>>>>4                //  22

At level 3 Number of nodes possible--------->>>>>8               //  23

At level 4 Number of nodes possible--------->>>>>16             //  24

so Ultimately we can generalize it like at Level H (height) Number of nodes possible--------->>>>> 2H

So to know total possible number of nodes add the maximum possible nodes at each individual level

Total number of possible nodes in level 'H' binary tree ---->>> 20+21+22+23+24.....+2H

So maximum nodes possible would be 2h+1-1

so n<= 2h+1-1 Now the log work you can do..

answered ago by Active (1.5k points)  


Top Users Jun 2017
  1. Bikram

    3694 Points

  2. Hemant Parihar

    1484 Points

  3. junaid ahmad

    1432 Points

  4. Arnab Bhadra

    1372 Points

  5. Niraj Singh 2

    1311 Points

  6. Rupendra Choudhary

    1194 Points

  7. rahul sharma 5

    1114 Points

  8. Arjun

    930 Points

  9. srestha

    922 Points

  10. Debashish Deka

    896 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 Jun 19 - 25
  1. Bikram

    1950 Points

  2. Niraj Singh 2

    1306 Points

  3. junaid ahmad

    502 Points

  4. sudsho

    410 Points

  5. akankshadewangan24

    388 Points


23,353 questions
30,061 answers
67,357 comments
28,378 users