in GATE
1,295 views
0 votes
0 votes
What was  the Expectancy in the full binary tree question asked in the exam ?

I got 3
in GATE
1.3k views

3 Answers

3 votes
3 votes
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.
2 votes
2 votes
4.85=34/7

4 Comments

Which seven cases you considered
0
0
For each leaf node, there were 7 other leaf nodes
0
0
But the question was about the distance in between the two nodes at the same level
0
0
Yes, all leaves are at same level, and they asked path length
0
0
0 votes
0 votes
I got the answer as 5.0

2 Comments

Anyone else please confirm our answer
0
0

I solved it as follows

0
0

Related questions

0 votes
0 votes
1 answer
2
mradul asked in GATE Feb 21, 2019
1,172 views
mradul asked in GATE Feb 21, 2019
by mradul
1.2k views
5 votes
5 votes
5 answers
3
0 votes
0 votes
2 answers
4
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

64.3k questions

77.9k answers

244k comments

80.0k users