Skip to content

Commit 3b6df49

Browse files
author
rpanjrath
committed
BT Common Ancestor: Fixing bug.
1 parent d9b3484 commit 3b6df49

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/trees/commonancestorbinarytree/CommonAncestorBinaryTree.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ private static boolean isLeftOrRightNode(SearchNode root, SearchNode node) {
5050
if (root == node) {
5151
return true;
5252
}
53-
boolean isLeft = isLeftOrRightNode((SearchNode) node.getLeftChild(), node);
54-
boolean isRight = isLeftOrRightNode((SearchNode) node.getRightChild(), node);
53+
boolean isLeft = isLeftOrRightNode((SearchNode) root.getLeftChild(), node);
54+
boolean isRight = isLeftOrRightNode((SearchNode) root.getRightChild(), node);
5555
return isLeft || isRight;
5656
}
5757
}

0 commit comments

Comments
 (0)