Let us create the Binary Tree as shown in the diagram .
tree . root = new Node ( 1 ) ; tree . root . left = new Node ( 2 ) ; tree . root . right = new Node ( 3 ) ; tree . root . left . left = new Node ( 4 ) ; tree . root . left . right = new Node ( 5 ) ; tree . root . right . left = new Node ( 6 ) ; tree . root . right . right = new Node ( 7 ) ; tree . root . left . right . left = new Node ( 8 ) ; tree . root . left . right . right = new Node ( 9 ) ; int u = 4 , v = 9 ; System . out . println ( " The ▁ LCA ▁ of ▁ node ▁ " + u + " ▁ and ▁ " + v + " ▁ is ▁ " + tree . findLCA ( tree . root , u , v ) ) ; } }