Driver program to test above function Let us create a binary tree given in the above example
root = Node ( 1 ) NEW_LINE root . left = Node ( 2 ) NEW_LINE root . right = Node ( 3 ) NEW_LINE root . left . left = Node ( 4 ) NEW_LINE root . left . right = Node ( 5 ) NEW_LINE root . right . left = Node ( 6 ) NEW_LINE root . right . right = Node ( 7 ) NEW_LINE print " LCA ( 4,5 ) ▁ = ▁ " , findLCA ( root , 4 , 5 ) . key NEW_LINE print " LCA ( 4,6 ) ▁ = ▁ " , findLCA ( root , 4 , 6 ) . key NEW_LINE print " LCA ( 3,4 ) ▁ = ▁ " , findLCA ( root , 3 , 4 ) . key NEW_LINE print " LCA ( 2,4 ) ▁ = ▁ " , findLCA ( root , 2 , 4 ) . key NEW_LINE