简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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