if(key == '1'){//insert at ->right.right
BinaryNode tempPointer = root;
while(tempPointer != null){
tempPointer = tempPointer.right;
}
BinaryNode newNode = new BinaryNode(x);
newNode.right = null;
newNode.left = null;
size++;
lastNode = newNode;
newNode.parent = tempPointer;
tempPointer.right = newNode;
}
It keeps saying termPointer can only be null at this location. I can't figure out why though.
This also fails:
newNode.parent = tempPointer.parent; //'tempPointer can only be null here'
tempPointer = newNode;