added lowest common ancestor alg.

added lowest common ancestor alg.