水平祖先问题的一种简单解法
A Simple Solution to the Level-Ancestor Problem
摘要:
级别祖先查询LA($u$,$d$)询问节点$u$在深度$d$的祖先。我们提出了一个简单的解决方案,在$O(n)$时间预处理树与$O(n)$额外的空间,并在$O(\log\ {n})$时间回答查询。虽然存在其他优化算法,但这是一个足够简单的解决方案,可以很容易地教授和实现。
英文摘要:
A Level Ancestory query LA($u$, $d$) asks for the the ancestor of the node $u$ at a depth $d$. We present a simple solution, which pre-processes the tree in $O(n)$ time with $O(n)$ extra space, and answers the queries in $O(\log\ {n})$ time. Though other optimal algorithms exist, this is a simple enough solution that could be taught and implemented easily.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。