Skip to content

Commit 08d94ee

Browse files
committed
basic definition
1 parent 2685309 commit 08d94ee

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* A symbol table implemented using a left-leaning red-black BST.
3+
*
4+
*/
5+
import java.util.NoSuchElememtException;
6+
7+
public class RedBlackBST<Key extends Comparable<Key>, value> {
8+
private static final boolean RED = true;
9+
private static final boolean BLACK = false;
10+
11+
private Node root; // root of the BST
12+
13+
// BST helper node data type
14+
private class Node {
15+
private Key key; // key
16+
private Value val; // associated data
17+
private Node left, right; // links to left and right subtrees
18+
private boolean color; // color of parent link
19+
private int size; // subtree count
20+
21+
public Node(Key key, Value val, boolean color, int size) {
22+
this.key = key;
23+
this.val = val;
24+
this.color = color;
25+
this.size = size;
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)