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
专知会员服务
127+阅读 · 2020年8月2日
强化学习最新教程,17页pdf
专知会员服务
182+阅读 · 2019年10月11日
2019年机器学习框架回顾
专知会员服务
36+阅读 · 2019年10月11日
机器学习入门的经验与建议
专知会员服务
94+阅读 · 2019年10月10日
【SIGGRAPH2019】TensorFlow 2.0深度学习计算机图形学应用
专知会员服务
41+阅读 · 2019年10月9日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
18+阅读 · 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会员
最新内容
反制无人机:乌克兰提供的五点启示
专知会员服务
4+阅读 · 9月23日
《各指挥层级均亟需红队能力》报告
专知会员服务
5+阅读 · 9月23日
《航电任务系统框架(FAMOS)》50页报告
专知会员服务
4+阅读 · 9月22日
《对抗行动中的人工智能与自主性》智库报告
专知会员服务
7+阅读 · 9月22日
《从数据到胜利:战争中的分析优势之争》
专知会员服务
10+阅读 · 9月22日
战争不仅需要机器人:人类仍不可或缺
专知会员服务
5+阅读 · 9月21日
《描绘美国防部创新基础设施的未来蓝图》100页
专知会员服务
10+阅读 · 9月21日
相关资讯
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
18+阅读 · 2018年12月24日
已删除
将门创投
9+阅读 · 2017年7月28日
Top
微信扫码咨询专知VIP会员