We present an approach to implement binary search trees in the rule-based graph programming language GP 2. Our implementation uses GP 2's rooted graph transformation rules to be fast and supports insertion, deletion and query operations. We argue that the worst-case runtime for each of the operations is O(n) for a tree with n nodes. In addition, we expect that, on average, the operations run in time O(log(n)). Hence the implementation would match the time complexity of binary search trees implementations in imperative languages.


翻译:我们提出了一种在基于规则的图编程语言GP 2中实现二叉搜索树的方法。我们的实现利用GP 2的有根图变换规则以达到快速执行,并支持插入、删除和查询操作。我们论证了对于包含n个节点的树,每个操作在最坏情况下的运行时间为O(n)。此外,我们预期在平均情况下,这些操作的运行时间为O(log(n))。因此,该实现的时间复杂度可与命令式语言中的二叉搜索树实现相匹配。

0
下载
关闭预览

相关内容

互联网
【NeurIPS2021】序一致因果图的多任务学习
专知会员服务
20+阅读 · 2021年11月7日
专知会员服务
19+阅读 · 2021年9月21日
专知会员服务
12+阅读 · 2021年6月20日
【CVPR2020-旷视】DPGN:分布传播图网络的小样本学习
专知会员服务
28+阅读 · 2020年4月1日
图节点嵌入(Node Embeddings)概述,9页pdf
专知
15+阅读 · 2020年8月22日
【NeurIPS2019】图变换网络:Graph Transformer Network
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
10+阅读 · 2014年12月31日
VIP会员
相关VIP内容
【NeurIPS2021】序一致因果图的多任务学习
专知会员服务
20+阅读 · 2021年11月7日
专知会员服务
19+阅读 · 2021年9月21日
专知会员服务
12+阅读 · 2021年6月20日
【CVPR2020-旷视】DPGN:分布传播图网络的小样本学习
专知会员服务
28+阅读 · 2020年4月1日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
10+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员