659 views
What was  the Expectancy in the full binary tree question asked in the exam ?

I got 3
in GATE | 659 views

I think the answer is 34/8 = 4.25.

Question: From a complete binary tree T of 8 leaf nodes, a and b are selected randomly and independently. What is the expected distance between a and b in T.

Here is how I solved it:

Since, the two leaf nodes are selected independently, both nodes can be same. If the leaf nodes are numbered 1 to 8 from left to right, then,

I can reach 1 node (i.e., same node) in a distance = 0

I can reach 1 node in a distance = 2

I can reach 2 nodes in a distance = 4

I can reach 4 nodes in a distance = 6

So, expected distance = (1 * 0 + 1 * 2 + 2 * 4 + 4 * 6)/(1 + 1 + 2 + 4) = 34/8.
4.85=34/7
by Active
0
Which seven cases you considered
0
For each leaf node, there were 7 other leaf nodes
0
But the question was about the distance in between the two nodes at the same level
0
Yes, all leaves are at same level, and they asked path length
I got the answer as 5.0
0
0

I solved it as follows +1 vote