以深度为k的满二叉树(n=2k
代码说明:
以深度为k的满二叉树(n=2k-1)为例,假设表中每个记录的查找概率相等,即 pi=1/n(1≤i≤n),而树的第i层上有2i-1个结点,因此,折半查找的平均查找长度为: 所以,折半查找的平均时间复杂度为O(log2n)。 -To a depth of k over the binary tree (n = 2k-1) as an example, suppose the table to find the probability of each record the same, that is, pi = 1/n (1 ≤ i ≤ n), and the tree layer of the first i There are 2i-1 nodes, therefore, to find half the average length of search as follows: Therefore, to find half the average time complexity is O (log2n).
下载说明:请别用迅雷下载,失败请重下,重下不扣分!