知识卡片

普通读书笔记卡 · 1292.f.1.a.5.c

旋转保留搜索树顺序

理解等级:中级

左旋以 x 的右孩子 y 为新子树根,把 y 原左子树转为 x 的右子树;右旋对称。

只改常数条指针,保持中序键顺序和搜索树约束,但旋转本身不保证红黑颜色条件,修复时需配合重新着色。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 第13章 红黑树 · 查看原书依据

      A rotation operation preserves the binary-search-tree property: the keys in α precede x.key, which precedes the keys in β, which precede y.key, which precedes the keys in γ.

    参考来源

    - 位置:《算法导论(第4版)》第 13 章13.2 节(`OEBPS/chapter013.xhtml`,文本字符 [5000, 15000);图 13.2–13.3、Art_P433–P434)。 - 结论依据:13.2 节 LEFT-ROTATE 先令 y=x.right,再把 y.left 接为 x.right 并改父子指针;图 13.2 的 α、β、γ 键序说明旋转保留 BST 性质。颜色修复属于调用它的插删过程。 - 原始内容:A rotation operation preserves the binary-search-tree property: the keys in α precede x.key , which precedes the keys in β , which precede y.key , which precedes the keys in γ .