什么是最低的共同祖先算法的实际应用? [英] What are the practical applications of the lowest common ancestor algorithms?

查看:257
本文介绍了什么是最低的共同祖先算法的实际应用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在看看<一href="http://stackoverflow.com/questions/3540622/lowest-common-ancestor-of-binary-treenot-binary-search-tree">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

这篇关于什么是最低的共同祖先算法的实际应用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆