GATE | GATE CS 2019 | Question 55

Let T be a full binary tree with 8 leaves. (A full binary tree has every level full.) Suppose two leaves a and b of T are chosen uniformly and independently at random. The expected value of the distance between a and b in T (i.e., the number of edges in the unique path between a and b) is (rounded off to 2 decimal places) ___________ .

Note: This was Numerical Type question.
(A) 5.71 to 5.73
(B) 4.85 to 4.86
(C) 2.71 to 2.73
(D) 4.24 to 4.26


Answer: (D)

Explanation: Full binary tree with 8 leaf nodes,

Two leaf nodes can be selected in 8*8 = 64 ways.

Where, X is length between two nodes selected.

The expected value of the length between a and b in T,

= E[X]
= X * P[X]
= 0*(8/64) + 2*(8/64) + 4*(16/64) + 6*(32/64)
= 272/64
= 4.25 

So, answer is 4.25.

Alternative way:
Sum of distances from a particular leaf to the remaining 7 leaves is 34. The sum would remain the same for each leaf node. Therefore total sum of distance of all the leaf nodes = 34*8.

Two leaf nodes can be selected in 8*8 = 64 ways.

Therefore, the expected value of the length between a and b in T,

= (34*8) / (8*8)
= 34 / 8
= 4.25


Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.