We analyze union-find using potential functions motivated by continuous algorithms, and give alternate proofs of the $O(\log\log{n})$, $O(\log^{*}n)$, $O(\log^{**}n)$, and $O(\alpha(n))$ amortized cost upper bounds. The proof of the $O(\log\log{n})$ amortized bound goes as follows. Let each node's potential be the square root of its size, i.e., the size of the subtree rooted from it. The overall potential increase is $O(n)$ because the node sizes increase geometrically along any tree path. When compressing a path, each node on the path satisfies that either its potential decreases by $\Omega(1)$, or its child's size along the path is less than the square root of its size: this can happen at most $O(\log\log{n})$ times along any tree path.
翻译:我们利用受连续算法启发的势函数分析并查集,并给出 $O(\log\log{n})$、$O(\log^{*}n)$、$O(\log^{**}n)$ 和 $O(\alpha(n))$ 摊还代价上界的替代证明。$O(\log\log{n})$ 摊还界的证明如下:设每个节点的势为其子树规模的平方根,即以其为根的子树的规模。由于沿任意树路径节点规模呈几何级数增长,总势能增加量为 $O(n)$。当压缩路径时,路径上的每个节点满足:要么其势能减少 $\Omega(1)$,要么沿路径的子节点规模小于其规模的平方根;沿任意树路径这种情况最多发生 $O(\log\log{n})$ 次。