CSC403: Put: Don't forget your children! [7/9] |
public void put (int key) { root = put (root, key); } private static Node put (Node x, int key) { if (x == null) return new Node (key); if (key < x.key) put (x.left, key); else if (key > x.key) put (x.right, key); //... }
This is kind of what we want.
Does it work?