private void case1(Tree t, Tree root) {
//System.out.println(root.left != t);
if (root.left != t || root.right != t)
case1(t, (root.value > t.value) ? root.left : root.right);
else {
if (root.left == t)
root.left = null;
else
root.right = null;
}
Why is the first IF condition evaluated TRUE even when root.left is actually equal to 't'? I have verified with print to console and the first condition does come out to be false. So the IF condition should be false. But the statement is still evaluated. The entire code is pretty big. I can provide more snippets if necessary. Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire