知识卡片
两侧孩子均最小时合并
在最小度为 t 的 B 树中,非根节点合法下限为 t−1 个键。删除内部键时,若其左右孩子都恰处下限,可把左孩子、父节点中的分隔键和右孩子合并,得到含 (t−1)+1+(t−1)=2t−1 个键的满节点,再在合并节点中递归删除目标。
这把删除转化为一个有余量的子树问题。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第18章 B树 · 查看原书依据
Case 2c: Both x.ci and x.ci+1have t − 1 keys. Merge k and all of x.ci+1 into x.ci, so that x loses both k and the pointer to x.ci+1, and x.ci now contains 2t − 1 keys. Then free x.ci+1 and recursively delete k from x.ci.
参考来源
- 位置:《算法导论(第4版)》第18章《B树》(OEBPS/chapter018.xhtml,文本字符[30000,35000))。
- 结论依据:原文Case 2c给出两侧下限节点的合并和后续递归。
- 原始内容:Case 2c : Both x . c i and x . c i +1 have t − 1 keys. Merge k and all of x . c i +1 into x . c i , so that x loses both k and the pointer to x . c i +1 , and x . c i now contains 2 t − 1 keys. Then free x . c i +1 and recursively delete k from x . c i .