You are viewing a single comment's thread. Return to all comments →
if(Math.min(v1,v2)<=root.data && Math.max(v1,v2)>=root.data) { return root;} if(v1>root.data){ return lca(root.right, v1, v2); } if(v1
Seems like cookies are disabled on this browser, please enable them to open this website
Binary Search Tree : Lowest Common Ancestor
You are viewing a single comment's thread. Return to all comments →
if(Math.min(v1,v2)<=root.data && Math.max(v1,v2)>=root.data) { return root;} if(v1>root.data){ return lca(root.right, v1, v2); } if(v1