全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Union by rank, path compression?

又称: rank (union--find) · union by rank · path compression

Definition 26.6 University Computer Science — Year 1 · 第 26 章 — Minimum Spanning Trees and Union–Find

Each root carries a rank, 0 at the start. Union by rank links the root of smaller rank under the other, and raises the rank of the new root by one when the two ranks were equal. Path compression makes every element met by a find point straight at the root.

Path compression. The find from c climbs three parent pointers; afterwards c, b and a hang from the root, and the next find from any of them climbs one. Ranks are not updated: a rank remains an upper bound on the height.
Path compression. The find from c climbs three parent pointers; afterwards c, b and a hang from the root, and the next find from any of them climbs one. Ranks are not updated: a rank remains an upper bound on the height.
在原文中阅读 →