You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the file java/DataStructures/Trees/BinaryTree.java maybe wrong about in remove function .
//If the successor has a right child, the child's grandparent is it's new parent
if (successor.right != null && successor.parent != temp) {
successor.right.parent = successor.parent;
successor.parent.left = successor.right;
successor.right = temp.right;
successor.right.parent = successor;
}
l think the right code is:
//If the successor has a right child, the child's grandparent is it's new parent
if(successor.parent!=temp){
if(successor.right!=null){
successor.right.parent = successor.parent;
successor.parent.left = successor.right;
successor.right = temp.right;
successor.right.parent = successor;
}else{
successor.parent.left=null;
successor.right=temp.right;
successor.right.parent=successor;
}
}
Am I thinking right?
The text was updated successfully, but these errors were encountered:
the file java/DataStructures/Trees/BinaryTree.java maybe wrong about in remove function .
l think the right code is:
Am I thinking right?
The text was updated successfully, but these errors were encountered: