Java Implementations
Node Implementation
private static final boolean RED = true;
private static final boolean BLACK = false;
class TreeNode{
private Key key;
private Value val;
private TreeNode left;
private TreeNode right;
private boolean color;
// ....... constructor ........
}
private boolean isRed(Node x){
if(x == null) return false;
return x.color == RED;
}
Search Operation

Elementary operations
Left Rotation


Right Rotation


Color Flip


Insertion
Case 1: Into Exactly 2-node


Case 2: Insert into 3-node


Passing red links up the tree

Java Implementation
Delete
Last updated