的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