标签:
p400 页最后一段
When j >= i , we need to select a root kr from among ki ... kj and then make an optimal binary search tree with keys ki ... kr-1 as its left subtree and an optimal binary search tree with keys kr+1 ... kj as its right subtree.What happens to the expected search cost of a subtree when it becomes a subtree of a node? (这里的subtree指的是ki ... kr-1构成的left subtree或kr+1 ... kj构成的right subtree) The depth of each node in the subtree increases by 1. By equation (15.11), the expected search cost of this subtree increases by the sum of all the probabilities in the subtree.
在计算以kr为root的tree的E[search cost in T]的时候
E[search cost in T] = e[i, j],包括3部分
所以
e[i,j] = pr + e[i,r-1] + w(i,r-1) + e[r+1,j] + w(r+1,j)
ITA 15.5 Optimal binary search trees
标签:
原文地址:http://www.cnblogs.com/patrickzhou/p/5812856.html