计算机应用 ›› 2015, Vol. 35 ›› Issue (3): 654-658.DOI: 10.11772/j.issn.1001-9081.2015.03.654

• 先进计算 • 上一篇    下一篇

低调整率的广义AVL树及其统一重平衡方法

江顺亮, 胡世鸿, 唐祎玲, 葛芸, 叶发茂, 徐少平   

  1. 南昌大学 信息工程学院, 南昌 330031
  • 收稿日期:2014-10-16 修回日期:2014-11-24 出版日期:2015-03-10 发布日期:2015-03-13
  • 通讯作者: 唐祎玲
  • 作者简介:江顺亮(1965-),男,江西丰城人,教授,博士生导师,博士,主要研究方向:计算机模拟与仿真、算法分析与设计、人工智能;胡世鸿(1989-),男,江西高安人,硕士研究生,主要研究方向:人工智能;唐祎玲(1977-),女,浙江奉化人,讲师,博士研究生,主要研究方向:算法分析与设计、人工智能;葛芸(1983-),女,江西高安人,讲师,博士研究生,主要研究方向:数字图像检索;叶发茂(1978-),男,江西金溪人,副教授,博士,主要研究方向:数字图像处理、计算机图形学;徐少平(1976-),男,江西九江人,副教授,博士,主要研究方向:图形图像处理、计算机视觉、虚拟手术仿真
  • 基金资助:

    国家自然科学基金资助项目(2012D41261091,2011F61163023)

Generalized AVL tree with low adjusting ratio and its unified rebalancing method

JIANG Shunliang, HU Shihong, TANG Yiling, GE Yun, YE Famao, XU Shaoping   

  1. School of Information Engineering, Nanchang University, Nanchang Jiangxi 330031, China
  • Received:2014-10-16 Revised:2014-11-24 Online:2015-03-10 Published:2015-03-13

摘要:

针对传统AVL(Adelson-Velskii and Landis)树重平衡算法代码量大、流程复杂、调整率过高的问题,提出一种统一重平衡算法,并提出广义AVL树的概念。统一重平衡算法能对AVL树的失衡节点进行自动分类、调整,取消了传统重平衡方法中的四种旋转操作。广义AVL树放松了AVL树的平衡约束,允许左右子树树高相差不超过N(N≥1),当更新操作(插入/删除)执行后,广义AVL树只在平衡约束条件不满足时采用统一重平衡算法进行调整。理论分析与实验结果表明,广义AVL树的调整率随着N的增大而显著降低:N为5时,调整率低于4%;N为13时调整率低于千分之一。广义AVL树的调整率远低于红黑树等经典数据结构,适合并发应用。

关键词: 广义AVL树, 放松平衡约束, 重平衡, 调整率

Abstract:

The traditional AVL (Adelson-Velskii and Landis) tree programming has been faced with the problem of too much code, complex process and high adjusting ratio. To solve these problems, a unified rebalancing method was developed and a generalized AVL (AVL-N) tree was defined. The unified rebalancing method automatically classifies the type of the unbalanced node in AVL tree and uses a new way to adjust the tree shape without using standard rotations. AVL-N tree with relaxed balance allows the height difference between the right sub-tree and left sub-tree doesn't exceed N(N ≥ 1). When insertions and deletions have been performed in AVL-N tree, the height difference between the right sub-tree and left sub-tree of some nodes may be higher than N. At that time the unified rebalancing would be applied to rearrange the unbalanced node's descendants. The simulation results indicate that the adjusting ratio of AVL-N tree reduced significantly with N increasing, it is less than 4% for N=5 and less than 0.1% for N=13. The adjusting ratio of AVL-N tree is far below other classic data structures, such as red-black tree, and allows for a greater degree of concurrency than the original proposal.

Key words: generalized Adelson-Velskii and Landis (AVL) tree, relaxed balance constraint, rebalancing, adjusting ratio

中图分类号: