arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2601.03897cs.PLcs.DS
收藏

在GP 2中实现二叉搜索树(扩展摘要)

Implementing Binary Search Trees in GP 2 (Extended Abstract)

University of Liverpool(利物浦大学);University of York(约克大学)

Ziad Ismaili Alaoui, Detlef Plump

AI总结:

本文在GP 2中实现了二叉搜索树,利用根图变换规则支持插入、删除和查询操作,论证了其时间复杂度与命令式语言中的二叉搜索树一致。

摘要:

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

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑