Added lca algorithm