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.


翻译:水平传承查询 LA( $, $d$) 要求节点的祖先在深度为 $ $ 美元 。 我们提出了一个简单的解决方案, 将树用美元( n) 时间和美元( n) 额外空间进行预处理, 并用美元( log\ { } $) 时间回答询问。 尽管存在其他最佳算法, 但这是一个非常简单的解决方案, 可以轻松地教授和实施 。

0
下载
关闭预览

相关内容

一份简单《图神经网络》教程,28页ppt
专知会员服务
120+阅读 · 2020年8月2日
强化学习最新教程,17页pdf
专知会员服务
168+阅读 · 2019年10月11日
2019年机器学习框架回顾
专知会员服务
35+阅读 · 2019年10月11日
机器学习入门的经验与建议
专知会员服务
90+阅读 · 2019年10月10日
【SIGGRAPH2019】TensorFlow 2.0深度学习计算机图形学应用
专知会员服务
39+阅读 · 2019年10月9日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
已删除
将门创投
9+阅读 · 2017年7月28日
Arxiv
0+阅读 · 2022年1月12日
Arxiv
0+阅读 · 2022年1月4日
Meta-Learning with Implicit Gradients
Arxiv
13+阅读 · 2019年9月10日
Learning to Importance Sample in Primary Sample Space
Arxiv
3+阅读 · 2018年2月24日
VIP会员
相关资讯
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
16+阅读 · 2018年12月24日
已删除
将门创投
9+阅读 · 2017年7月28日
Top
微信扫码咨询专知VIP会员