摘要:
对于两个节点的最低父节点的定义可以分为两种情况(1)像5和8最低公共父节点是3,两节点之间不存在父子关系(2)两节点存在父子关系,如5和4,最低公共父节点是5。引用维基百科的话:Thelowest common ancestor(LCA) is a concept ingraph theoryandcomputer science. LetTbe a rootedtreewithnnodes. The lowest common ancestor between two nodesvandwis defined as the lowest node inTthat has bothvandwa 阅读全文