的O(log n)的发现仅仅是真实的。当我们使用这个优化时,我们总是把排名较低的树下的树放在树的根下。如果两者具有相同的等级,我们任意选择,但是将得到的树的等级增加1。这给出了一个O(log n)在树的深度上的界限。那就是根我水平以下的节点(相当于秩的树是> = 我)是在至少2 我节点树我们可以显示证明这一点(这是与展示尺寸为的树相同,其具有的尺寸为具有日志n深度)。这很容易通过感应来完成。
Induction hypothesis: tree size is >= 2^j for j < i.
Case i == 0: the node is the root, size is 1 = 2^0.
Case i + 1: the length of a path is i + 1 if it was i and the tree was then placed underneath
another tree. By the induction hypothesis, it was in a tree of size >= 2^i at
that time. It is being placed under another tree, which by our merge rules means
it has at least rank i as well, and therefore also had >= 2^i nodes. The new tree
therefor has >= 2^i + 2^i = 2^(i + 1) nodes.
您能否提供此声明的来源? – amit
有一个错字,我纠正它。这是一个本地考试,并已扫描文档。 @amit –
我认为答案是aaaa – user3661613