 Better algorithms exist that, analogous to the LCA algorithms on trees, preprocess a graph to enable constant-time LCA queries.The problem of "LCA existence" can be solved optimally for sparse DAGs by means of an algorithm due to .The problem of computing lowest common ancestors of classes in an inheritance hierarchy arises in the implementation of object-oriented programming systems .