avlTree 自平衡二叉查找树 是在插入的时候进行旋转,使树的深度相同(不超过1)
![](灵魂画图/valTree单旋.png)

splayTree 伸展树 是在搜索的时候将节点往上提,提到根节点

单次旋转
```graphviz
digraph{
    label="初始状态"
    l_6;l_77;
    a_7[color=blue]
    b_8[color=red]
    a_7->l_6->l_5
    a_7->b_8->r_9
    b_8->l_77
    l_6->r_66
}
```
```cpp
int tmp = a->data;
a->data = b->data;
b->data = tmp;
```
```graphviz
digraph{
    label="交换ab"
    l_6;l_77;
    b_7[color=red]
    a_8[color=blue]
    a_8->l_6->l_5
    a_8->b_7->r_9
    b_7->l_77
    l_6->r_66
}
```
```cpp
//之后处理节点,需要吧b_7移动到左边,a_8左指向b_7
//b_7左指向原a_8左(l_6),b_7右指向原b_7左(l_77)
//a_8右指向b_7右(r_9)
prt_tree tmp=a_8->lt;
a_8->lt=b_7;
a_8->rt=b_7->rt;
b_7->rt=b_7->lt;
b_7->lt=tmp;
```
```graphviz
digraph{
    label="处理节点"
    l_6;r_77;
    b_7[color=red]
    a_8[color=blue]
    a_8->b_7->l_6->l_5
    a_8->r_9
    b_7->r_77
    l_6->r_66
}
```
