Here are the melodrama, with three characters, Root,pivot, and the bottom node.
Photo Citation: https://blog.csdn.net/u012361418/article/details/46535293
According to the order of the three nodes from top to bottom, there are four kinds of cases: the left-left type, right-right type and right-left type, respectively.
1. Left-Left (pivot is the left node of the root node and the bottom node is the left node of pivot)
At this time we make the action to be the right paddle, because it seems to be clockwise rotation, (unified clockwise called the right, counterclockwise called left)
Pivot to the root node says:
I am now your left node;
I want you to do my right node,
This is just my original right node, which is your left node.
Perfect alternative ...
So happy to have finished the adjustment ~
2. Right-right type
At this time, we need to rotate the root node to the left, which is called L;
Pivot to the root says:
I am now your right node,
I want you to be my left node,
So just my original left node, do your right node;
Once again the perfect spin ~
3. Right and left type
Don't be afraid, everyone. Do not escape ~ ~ ~ Because this time finally the bottom node of the play part ... (Touched ....) )
First, the bottom node says to pivot:
I'm your right node,
I want you to be my left node,
So my original left node, just give you right node;
Ha ha...
You know what..
Now it's left and left.
Then the first case of analysis can go on.
Let me just say it here. (After all, this time the original bottom node becomes a new pivot ....) The drama has a sudden spike in wood. )
This time the new pivot (the original bottom node) says to the root node:
I am now your left node,
I want you to be my right node,
So my original right node just happens to be your left node.
This is the perfect place to be an AVL tree.
4. Right-left (right-hand)
The bottom node is right-handed, then the right-right type, the root node left-hand;
This time the bottom node of the play is also more ~
First, the bottom node says to pivot:
I'm your left node,
I want you to be my right node,
So my right node just happens to be your left node;
Then it becomes the right-right type (at which point the bottom node becomes the new pivot)
Then the right-right type of processing, here is left for you to practice it ~ ~