arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2504.03259cs.DScs.AI
收藏

一个用于教授红黑树中带旋转的双黑删除的扩展符号算术模型

An Extended Symbolic-Arithmetic Model for Teaching Double-Black Removal with Rotation in Red-Black Trees

Wenzhou Kean University(温州肯恩大学);College of Science, Mathematics and Technology(科学、数学与技术学院)

Kennedy E. Ehimwenma, Hongyu Zhou, Junfeng Wang, Ze Zheng

AI总结:

本文扩展符号算术代数方法,提出三个数学方程,解决红黑树中带旋转和重新着色的双黑节点删除问题,有效平衡黑高,辅助教学。

摘要:

双黑(DB)节点在红黑(RB)树中没有位置。因此,当DB节点形成时,它们会被立即删除。DB节点的删除会导致其他相连节点的旋转和重新着色,这在RB树的教学与学习中带来了更大的挑战。为了缓解这一困难,本文扩展了我们先前关于用于删除DB节点的符号算术代数(SA)方法的工作。给出的SA运算为:红 + 黑 = 黑;黑 - 黑 = 红;黑 + 黑 = DB;以及 DB - 黑 = 黑,这些运算用于删除DB节点并重新平衡RB树中的黑高。通过扩展,本文提出了三个SA数学方程,即:一般符号算术规则;部分符号算术规则1;以及部分符号算术规则2。DB节点的删除最终会影响RB树中的黑高。为了使用SA方程平衡黑高,本研究考虑了所有RB树的情况,即LR、RL、LL和RR;并且也测试了与DB节点直接或间接相连的节点的位置。在本研究中,为了平衡RB树,针对RB树的不同情况所考虑的问题包括:i)DB节点是否具有内侧、外侧、或同时具有内侧和外侧黑侄子;或者ii)DB节点是否具有内侧、外侧、或同时具有内侧和外侧红侄子。在本研究中,侄子r和x是DB的兄弟s的孩子,而在树的更上层,DB的父节点p是它们的祖父g。因此,在DB节点形成时,r和x与DB具有间接关系。SA方程的新颖之处在于其能够有效删除涉及节点旋转以及沿任意简单路径对节点进行重新着色的DB,从而平衡树中的黑高。

英文摘要:

Double-black (DB) nodes have no place in red-black (RB) trees. So when DB nodes are formed, they are immediately removed. The removal of DB nodes that cause rotation and recoloring of other connected nodes poses greater challenges in the teaching and learning of RB trees. To ease this difficulty, this paper extends our previous work on the symbolic arithmetic algebraic (SA) method for removing DB nodes. The SA operations that are given as, Red + Black = Black; Black - Black = Red; Black + Black = DB; and DB - Black = Black removes DB nodes and rebalances black heights in RB trees. By extension, this paper projects three SA mathematical equations, namely, general symbolic arithmetic rule; partial symbolic arithmetic rule1; and partial symbolic arithmetic rule2. The removal of a DB node ultimately affects black heights in RB trees. To balance black heights using the SA equations, all the RB tree cases, namely, LR, RL, LL, and RR, were considered in this work; and the position of the nodes connected directly or indirectly to the DB node was also tested. In this study, to balance a RB tree, the issues considered w.r.t. the different cases of the RB tree were i) whether a DB node has an inner, outer, or both inner and outer black nephews; or ii) whether a DB node has an inner, outer or both inner and outer red nephews. The nephews r and x in this work are the children of the sibling s to a DB, and further up the tree, the parent p of a DB is their grandparent g. Thus, r and x have indirect relationships to a DB at the point of formation of the DB node. The novelty of the SA equations is in their effectiveness in the removal of DB that involves rotation of nodes as well as the recoloring of nodes along any simple path so as to balance black heights in a tree.

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

↑