@@ -123,13 +123,13 @@ If the child `c2` at index `i-1` has more keys than the order of the tree:
123
123
124
124
1 . We move the key at index ` i-1 ` from the parent node to the child ` c1 ` 's keys array at index ` 0 ` .
125
125
2 . We move the last key from ` c2 ` to the parent's keys array at index ` i-1 ` .
126
- 3 . (If ` c1 ` is non-leaf) We move the last children from ` c1 ` to ` c2 ` 's children array at index 0.
126
+ 3 . (If ` c1 ` is non-leaf) We move the last child from ` c2 ` to ` c1 ` 's children array at index 0.
127
127
128
128
Else:
129
129
130
130
1 . We move the key at index ` i ` from the parent node to the end of child ` c1 ` 's keys array.
131
131
2 . We move the first key from ` c2 ` to the parent's keys array at index ` i ` .
132
- 3 . (If ` c1 ` isn't a leaf) We move the first children from ` c2 ` to the end of ` c1 ` 's children array.
132
+ 3 . (If ` c1 ` isn't a leaf) We move the first child from ` c2 ` to the end of ` c1 ` 's children array.
133
133
134
134
![ Moving Key] ( Images/MovingKey.png )
135
135
@@ -141,13 +141,13 @@ If `c1` has a left sibling `c2`:
141
141
142
142
1 . We move the key from the parent at index ` i-1 ` to the end of ` c2 ` 's keys array.
143
143
2 . We move the keys and the children(if it's a non-leaf) from ` c1 ` to the end of ` c2 ` 's keys and children array.
144
- 3 . We remove the children at index ` i ` from the parent node.
144
+ 3 . We remove the child at index ` i-1 ` from the parent node.
145
145
146
146
Else if ` c1 ` only has a right sibling ` c2 ` :
147
147
148
148
1 . We move the key from the parent at index ` i ` to the beginning of ` c2 ` 's keys array.
149
149
2 . We move the keys and the children(if it's a non-leaf) from ` c1 ` to the beginning of ` c2 ` 's keys and children array.
150
- 3 . We remove the children at index ` i ` from the parent node.
150
+ 3 . We remove the child at index ` i ` from the parent node.
151
151
152
152
After merging it is possible that now the parent node contains too few keys,
153
153
so in the worst case merging also can go up to the root, in which case the height of the tree decreases.
0 commit comments