LL型
struct TreeNode *SingleRotateWithLeft(struct TreeNode* root){
struct TreeNode *Node;
Node=root->left;
root->left=Node->right;
Node->right=root;
return Node;
}
RR型
struct TreeNode *SingleRotateWithRight(struct TreeNode* root){
struct TreeNode *Node;
Node=root->right;
root->right=Node->left;
Node->left=root;
return Node;
}
LR型
struct TreeNode *DoubleRotateWithLeft(struct TreeNode* root){
root->left=SingleRotateWithRight(root->left);
return SingleRotateWithLeft(root);
}
RL型
struct TreeNode *DoubleRotateWithRight(struct TreeNode* root){
root->right=SingleRotateWithLeft(root->right);
return SingleRotateWithRight(root);
}