If we want to remove assumptions in finding LCA(a,b).
i.e.
Assumption 1 - both and b are present in the tree.
Assumption 2 - all keys are unique.
How do we remove both the assumptions…?
If we want to remove assumption 1, do we have to traverse the whole tree and check if a and b, both are present… It will not be efficient, I guess. Is there any other method?.
Also If duplicates are present in tree, how do we resolve this problem?
Video reference – Lowest Common Ancestor(LCA).