知识卡片
搜索树约束作用于整棵子树
二叉搜索树要求每个节点的左子树全部键不大于该节点,右子树全部键不小于它,且对每个子树递归成立。
仅比较直接子节点不够;书中允许相等键,因此这个版本不是严格小于关系。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第12章 二叉搜索树 · 查看原书依据
If y is a node in the left subtree of x, then y.key ≤ x.key. If y is a node in the right subtree of x, then y.key ≥ x.key.
参考来源
- 位置:《算法导论(第4版)》第 12 章 12.1 节(`OEBPS/chapter012.xhtml`,文本字符 [0, 5000))。
- 结论依据:12.1 节对任意节点 x 的整棵左子树规定 y.key≤x.key、右子树规定 y.key≥x.key;图 12.1 含相等键 5,并说明性质对每个节点递归成立。
- 原始内容:If y is a node in the left subtree of x , then y.key ≤ x.key . If y is a node in the right subtree of x , then y.key ≥ x.key .