我在看看this问题然后阅读有关的Tarjan的至少共同祖先算法。我从来没有碰到过的LCA算法的应用程序。
I was having a look at this question and then reading about Tarjan's least common ancestors algorithm. I never came across any applications of LCA algorithms before.
在哪里这样的LCA常用算法?
Where are such LCA algorithms commonly used?
在编译器中,两个基本模块的LCA是,你可以把一个计算,以使其适用于这两个地方。这可能是用于消除共同SUBEX pressions,或对于SSA转换插入披节点是有用的。这些算法以及进化和高度优化的,不过,这样的LCA本身可能很难看到,例如, SSA 和 pre
In compilers, the LCA of two basic blocks is a place you can put a computation so it is available to both. This might be useful for eliminating common subexpressions, or inserting phi-node for SSA conversion. These algorithms are well evolved and highly optimized, though, so the LCA itself may be hard to see, e.g., SSA and PRE