diff --git a/TerryModi/RBTree.java b/TerryModi/RBTree.java index ca05b67..8c4072f 100644 --- a/TerryModi/RBTree.java +++ b/TerryModi/RBTree.java @@ -29,7 +29,7 @@ class RBTree> { Node parent = null; // Traverse the tree to the left or right depending on the key, - // finding a correct postion for the insertion of nodes later + keep the structure of the tree + // finding a correct position for the insertion of nodes later + keep the structure of the tree while (node != null) { parent = node; if (key.compareTo(node.key) < 0) { // key < node.key @@ -165,9 +165,6 @@ class RBTree> { throw new IllegalStateException("Node is not a child of its parent"); } - if (rightChild != null) { - rightChild.parent = parent; - } RootBlack(); @@ -197,10 +194,6 @@ class RBTree> { throw new IllegalStateException("Node is not a child of its parent"); } - if (leftChild != null) { - leftChild.parent = parent; - } - RootBlack(); return leftChild;