Skip to content

Commit 7e4f89c

Browse files
📚 docs: Correctly reference analysis cases.
This was broken since we renamed the cases.
1 parent d4573c4 commit 7e4f89c

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/deletion/delete_case1.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ const delete_case1 = (n) => {
2727
assert(s instanceof Node);
2828

2929
if (s._color === BLACK) {
30-
// If n's sibling is BLACK, go to case 3.
30+
// If n's sibling is BLACK, go to case 2.
3131
delete_case2(n);
3232
} else {
3333
/**
34-
* Otherwise, prepare for and go to case 4.
34+
* Otherwise, prepare for and go to case 3.
3535
*
3636
* B B
3737
* / \ / \

src/deletion/delete_case2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const delete_case2 = (n) => {
4747
delete_case0(n.parent);
4848
}
4949

50-
// Otherwise, go to case 4.
50+
// Otherwise, go to case 3.
5151
else delete_case3(n);
5252
};
5353

src/deletion/delete_case3.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const delete_case3 = (n) => {
4545
* - - - - - - - -
4646
*/
4747
if (
48-
// The parent color test is always true when coming from case 2
48+
// The parent color test is always true when coming from case 1
4949
n.parent._color !== BLACK &&
5050
(s.left === null || s.left._color === BLACK) &&
5151
(s.right === null || s.right._color === BLACK)
@@ -54,7 +54,7 @@ const delete_case3 = (n) => {
5454
n.parent._color = BLACK;
5555
}
5656

57-
// Otherwise, go to case 5.
57+
// Otherwise, go to case 4.
5858
else delete_case4(n);
5959
};
6060

src/deletion/delete_case4.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const delete_case4 = (n) => {
2929
assert(s.left?._color === RED || s.right?._color === RED);
3030

3131
// The following statements just force the red n's sibling child to be on
32-
// the left of the left of the parent, or right of the right, so case 6
32+
// the left of the left of the parent, or right of the right, so case 5
3333
// will rotate correctly.
3434

3535
/**

0 commit comments

Comments
 (0)