简体   繁体   中英

Optimal binary search tree - Cormen

在此处输入图片说明

I am looking into optimal binary search tree in Introduction to Algorithms by Cormen etc. For reference I am attaching a text link .

Here on page 399 we have table which has contribution. I am not able to understand how author calculated this column. For example node k1 contribution is 0.30, k4 is 0.20. How has the author calculated this?

Look at the formula to get search cost in T => E[search cost in T]=.... (page 398 the bottom)

To get cost for k1:

k1=(depth(k1) + 1) * p1

Look at the table is given for value of depth(k1) and p1 (page 399) .

k1=(1+1)*0.15
  =2*0.15
  =0.3

k2=(0+1)*0.10
  =1*0.10
  =0.10

etc

I hope my explanation can help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM