Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Balance_Tree(Node current)
- {
- Node P;
- if (Balance_Factor(current) == 2)//left column
- {
- P = current.left;
- if (Balance_Factor(P) == -1)
- {
- RotateLeftRight(P);//left right case
- }
- else
- {
- RotateLeftLeft(current);//left left case
- }
- }
- if (Balance_Factor(current.left) == -2)//right column
- {
- P = current.right;
- if (Balance_Factor(P) == 1)
- {
- RotateRightLeft(P);//right left case
- }
- else
- {
- RotateLeftLeft(current);//right right case
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement