9. 二叉搜索树

Tree insert: searchs for that element A[i]
Tree walk:

Theorem:

E[height of a randomly built binary search tree] = O(lg n)

Proof outline

  1. Prove Jensen's inequality:
    for convex function f
  2. Instead of analyzing = the random variable of the height of a randomly constructed BST on n nodes, we analize
  3. Prove that
  4. Conclude that

(by Luke Devroy, 1986)

Proof 1.Jensen's inequality

is convex if for all and all with ,

vector and convex function

Lemma

if is convex & & & ,
then

灰色区域某一点意味着不等号右边

Induction
Base Case: When n = 1,
, 不等式
成立。
Induction Step:



Jensen's inequality

(f is a convex and X is a integer random variable)
proof:

Proof 2. Analysis Yn

Xn = the random variable of the height of a randomly constructed BST on n nodes. Yn = 2 Xn

If root r has rank k, then Xn = 1 + max{Xk-1, Xn-k}, Yn = 2 * max{Yk-1, Yn-k}

define indicator r.v.'s

Pr{Znk = 1} = E[Znk] = 1/n

Proof 3. Analysis E[Yn]







Then, we are going to use substitution.
Claim:
Proof:
The base case must be true when c is sufficiently large.
Induction Step:

Proof 4.

(简单地使用了Jensen's inequality)
( lg(O(n3)) = lg(cn3) = 3lg(n) + lg(c) )

你可能感兴趣的:(9. 二叉搜索树)