Skip to content

Commit c9610ce

Browse files
authored
Merge pull request #476 from 0xsatoshi99/fix-2-3-tree-doc-issue-275
Fix 2-3 tree documentation error - Fixes #275
2 parents e4e5aef + 596a42c commit c9610ce

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

docs/md/algorithm/data-structures/2022-10-01-tree-2-3.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ lock: need
3939
</div>
4040

4141
- 2-3 树的插入过程与 BST 树类似,会通过树的左右节点大小,找到自己的插入位置。
42-
- 一个节点可以右1-3个元素,但当元素个数为3时,则需要调衡。把三个节点的中间节点晋升上来,其余两个节点为子节点。
42+
- 一个节点可以有1-2个元素(注意:不是1-3个),但当元素个数为3时,则需要调衡。把三个节点的中间节点晋升上来,其余两个节点为子节点。
4343
- 如果进行一次调衡后,上一层父节点达到3个元素,则需要2次调衡,来满足2-3树的规则。
4444

45+
**注意**:2-3树的定义是每个节点可以有1-2个元素,当插入导致节点有3个元素时需要立即调衡。例如在插入节点9之前的树结构中,父节点6应该只有一个元素,其左子树为节点5。这样的结构符合2-3树的定义,也便于后续插入节点9时的调衡操作。
46+
4547
**咋样**,是不看过这个图之后对于2-3树的实现已经有感觉了,想动手写写试试了?
4648
- 源码地址:[https://github.com/fuzhengwei/java-algorithms](https://github.com/fuzhengwei/java-algorithms)
4749
- 本章源码:[https://github.com/fuzhengwei/java-algorithms/tree/main/data-structures/src/main/java/tree](https://github.com/fuzhengwei/java-algorithms/tree/main/data-structures/src/main/java/tree)

0 commit comments

Comments
 (0)