Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void CheckStability(Gamer gLeaf)
- {
- gLeaf.CalcDepth();
- if (gLeaf.left == null)
- {
- if (gLeaf.right != null&&gLeaf.right.depth>=2)
- {
- RotateLeft(gLeaf);
- //return true;
- }
- }
- else
- {
- if (gLeaf.right == null)
- {
- if (gLeaf.left.depth >=2)
- {
- RotateRight(gLeaf);
- // return true;
- }
- }
- else
- {
- if (gLeaf.left.depth - gLeaf.right.depth > 1)
- {
- RotateRight(gLeaf);
- // CheckStability(gLeaf.parent);
- }
- else if (gLeaf.right.depth - gLeaf.left.depth > 1)
- {
- RotateLeft(gLeaf);
- // CheckStability(gLeaf.parent);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement