知识卡片
内部键删除可用邻键替换
在最小度为 t 的 B 树中,要删除内部节点中的键,
- 若前驱所在左孩子至少有
t个键,可在其子树找前驱、递归删前驱,再用前驱替换原键; - 右孩子足够时对称地用后继。
前提是下行孩子有余量,避免替换后欠填。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第18章 B树 · 查看原书依据
Case 2a: x.ci has at least t keys. Find the predecessor k′ of k in the subtree rooted at x.ci. Recursively delete k′ from x.ci, and replace k by k′ in x. (Key k′ can be found and deleted in a single downward pass.)
参考来源
- 位置:《算法导论(第4版)》第18章《B树》(OEBPS/chapter018.xhtml,文本字符[30000,35000))。
- 结论依据:原文Case 2a给出前驱替换,紧随的Case 2b说明后继对称情形。
- 原始内容:Case 2a: x . c i has at least t keys. Find the predecessor k ′ of k in the subtree rooted at x . c i . Recursively delete k ′ from x . c i , and replace k by k ′ in x . (Key k ′ can be found and deleted in a single downward pass.)