8000 Merge pull request #308 from ViktorSimko/master · codee/swift-algorithm-club@bc1ac82 · GitHub
[go: up one dir, main page]

Skip to content

Commit bc1ac82

Browse files
authored
Merge pull request kodecocodes#308 from ViktorSimko/master
fixed typos in B-Tree README
2 parents 5549e1b + e0f1328 commit bc1ac82

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

B-Tree/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ If the child `c2` at index `i-1` has more keys than the order of the tree:
123123

124124
1. We move the key at index `i-1` from the parent node to the child `c1`'s keys array at index `0`.
125125
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.
127127

128128
Else:
129129

130130
1. We move the key at index `i` from the parent node to the end of child `c1`'s keys array.
131131
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.
133133

134134
![Moving Key](Images/MovingKey.png)
135135

@@ -141,13 +141,13 @@ If `c1` has a left sibling `c2`:
141141

142142
1. We move the key from the parent at index `i-1` to the end of `c2`'s keys array.
143143
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.
145145

146146
Else if `c1` only has a right sibling `c2`:
147147

148148
1. We move the key from the parent at index `i` to the beginning of `c2`'s keys array.
149149
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.
151151

152152
After merging it is possible that now the parent node contains too few keys,
153153
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

Comments
 (0)
0