Problem with binary tree task

Status
Not open for further replies.

wcppcw

Newbie level 1
Joined
Apr 1, 2007
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,294
a problem of binary tree

i have met a problem:
if a binary tree has n leaf nodes, the maximal depth of the tree is n-1 and the minimal is ceil( log2 ), what is the mean depth of the binary tree?

i have got a formular conclusion:
avg_k=Σ(k*p_k)
where p_k means the probability of the depth equals to k,
p_k=c(2^k-1-i, n-1-i)/c(2^i, n-1)!

but it seems to be wrong!

who can help me!?
thx!
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…