AVLTree RRotation( AVLTree PreviousTreeHead ) {
TNode p = PreviousTreeHead;
AVLTree T = p->left;
p->left = T->right;
T->right = p;
return t;
}
AVLTree LRotation( AVLTree PreviousTreeHead ) {
TNode p = PreviousTreeHead;
AVLTree T = p->right;
p->right = T->left;
T->left = p;
return T;
}
AVLTree RLRotation( AVLTree PreviousTreeHead ) {
TNode p = PreviousTreeHead;
p->right = RRotation( p->right );
return LRotation( p );
}
AVLTree LRRotation( AVLTree PreviousTreeHead ) {
TNode p = PreviousTreeHead;
p->left = LRotation( p->left );
return RRotation( p );
}
复习数据结构,唉,效率真低。加油
平衡二叉树的旋转
最新推荐文章于 2021-11-28 21:35:27 发布