/**
* Base class for node
*
* @param
*/
public class Node
Colour colour; // Node colour
T key; // Node key
Node
Node
public Node(T key) {
this.key = key;
this.colour = Colour.RED; //property 3 (if a node is red, both children are black) may be violated if parent is red
this.parent = null;
// Initialise children leaf nodes
this.left = new Node
this.right = new Node
this.left.parent = this; //reference to parent
this.right.parent = this; //reference to parent
}
// Leaf node
public Node() {
this.key = null; //leaf nodes are null
this.colour = Colour.BLACK; //leaf nodes are always black
}
}