edited by
933 views
3 votes
3 votes

Consider a perfect binary tree with $\mathrm{n}$ nodes and $\mathrm{h}$ height. A tree is perfect when all levels of the tree are completely full. Let root is at depth $0$ and leaves are at height $0.$

Assume Expected height of any node is $E_{h}$ and Expected depth of any node is $E_{d}$.

If we choose any node uniformly randomly then which of the following is the correct option about $S1$ and $S2?$

  • $S1: \displaystyle{} E_{d}=\frac{1}{n} \sum_{r=0}^{h} r 2^{r}$
  • $S2: \displaystyle{} E_{h}=\frac{1}{n} \sum_{r=0}^{h} r 2^{h-r}$
  1. $S1$ is correct but $S2$ is incorrect
  2. $S1$ is incorrect but $S2$ is correct
  3. Both are correct
  4. Both are incorrect
edited by

1 Answer

1 votes
1 votes
Let say a graph:    (a) d=0 h=2
                            |       |
                         (b)     (c)  h=1 d=1
                          | |        | |

                        (d)(e)   (f)(g)    h=0 d=2

total h= 2 dep = 2

E(depth) = 1/7(0+1+1+2+2+2+2)=10/7

E(height) = 1/7(0+0+0+0+1+1+2)=4/7

place value in equation and it will be same

 

 
Answer:

No related questions found