forked from Arsenalist/Red-Black-Tree-Java-Implementation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRedBlackNode.java
More file actions
40 lines (35 loc) · 944 Bytes
/
Copy pathRedBlackNode.java
File metadata and controls
40 lines (35 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
*/ // class RedBlackNode
class RedBlackNode<T extends Comparable<T>> {
/** Possible color for this node */
public static final int BLACK = 0;
/** Possible color for this node */
public static final int RED = 1;
// the key of each node
public T key;
/** Parent of node */
RedBlackNode<T> parent;
/** Left child */
RedBlackNode<T> left;
/** Right child */
RedBlackNode<T> right;
// the number of elements to the left of each node
public int numLeft = 0;
// the number of elements to the right of each node
public int numRight = 0;
// the color of a node
public int color;
RedBlackNode(){
color = BLACK;
numLeft = 0;
numRight = 0;
parent = null;
left = null;
right = null;
}
// Constructor which sets key to the argument.
RedBlackNode(T key){
this();
this.key = key;
}
}// end class RedBlackNode