简体   繁体   English

AVL 树中是否存在左、右、右、右旋转以进行平衡?

[英]Is there a Left,Right,Right,Right rotation in AVL tree for balancing?

I have the following keys (string type).我有以下键(字符串类型)。 They are inserted one at a time in this order,它们按此顺序一次插入一个,

know->world->state->agent->estimate->figure->compute->symbols->bayes->model知道->世界->状态->代理->估计->图形->计算->符号->贝叶斯->模型

I am getting stuck on adding figure.我被困在添加数字上。 I have included "string[balancing factor]" Can someone guide me if I did something wrong?我已包含“字符串 [平衡因子]” 如果我做错了什么,有人可以指导我吗?

            state[2]
              /\
             /  \
            /    \
    estimate[-1] world[0]
        /\
       /  \
      /    \
 agent[0] know[1]
           /
          /
       figure[0]

The structure of your tree looks good.你的树的结构看起来不错。 You'll just have to perform a rotation to make it balanced.您只需要执行旋转以使其平衡。

For reference, this website should help you visualize insertion and deletion in an AVL tree作为参考,这个网站应该可以帮助您可视化 AVL 树中的插入和删除

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM