O(log n) の検索は、ランクによる結合(加重結合とも呼ばれます) を使用する場合にのみ真になります。この最適化を使用する場合、常にランクの低いツリーをランクの高いツリーのルートの下に配置します。両方のランクが同じ場合、任意に選択しますが、結果のツリーのランクを 1 つ上げます。これにより、ツリーの深さに制限された O(log n) が得られます。これは、ルートのiレベル下にあるノード (ランク >= iのツリーにあることに相当) が少なくとも 2 iノードのツリーにあることを示すことで証明できます(これは、サイズのツリーを表示するのと同じです)。nには log 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.