LCA algorithms for BST and binary tree