计算机科学 > 数据结构与算法
[提交于 2021年11月9日]
标题:A Simple Solution to the Level-Ancestor Problem
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读摘要: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.
提交历史
来自:Gaurav Menghani[v1] 2021年11月9日 星期二 00:00:00 UTC