File tree 2 files changed +2
-10
lines changed
2 files changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -19,12 +19,4 @@ export class RedBlackNode<K> extends Node<K> {
19
19
isRed ( ) {
20
20
return this . color === Colors . RED ;
21
21
}
22
-
23
- flipColor ( ) {
24
- if ( this . color === Colors . RED ) {
25
- this . color = Colors . BLACK ;
26
- } else {
27
- this . color = Colors . RED ;
28
- }
29
- }
30
22
}
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ export default class RedBlackTree<T> extends BinarySearchTree<T> {
111
111
const uncle = grandParent . right ;
112
112
113
113
// case 1: uncle of node is also red - only recoloring
114
- if ( uncle && uncle . color === Colors . RED ) {
114
+ if ( uncle && uncle . isRed ( ) ) {
115
115
grandParent . color = Colors . RED ;
116
116
parent . color = Colors . BLACK ;
117
117
uncle . color = Colors . BLACK ;
@@ -137,7 +137,7 @@ export default class RedBlackTree<T> extends BinarySearchTree<T> {
137
137
const uncle = grandParent . left ;
138
138
139
139
// case 1: uncle is read - only recoloring
140
- if ( uncle && uncle . color === Colors . RED ) {
140
+ if ( uncle && uncle . isRed ( ) ) {
141
141
grandParent . color = Colors . RED ;
142
142
parent . color = Colors . BLACK ;
143
143
uncle . color = Colors . BLACK ;
You can’t perform that action at this time.
0 commit comments