Advertisement
Mellowlicious

checkstability

Jun 28th, 2011
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1.  
  2.         public void CheckStability(Gamer gLeaf)
  3.         {
  4.             gLeaf.CalcDepth();
  5.             if (gLeaf.left == null)
  6.             {
  7.                 if (gLeaf.right != null&&gLeaf.right.depth>=2)
  8.                 {
  9.                     RotateLeft(gLeaf);
  10.                     //return true;
  11.                 }              
  12.             }
  13.             else
  14.             {
  15.                 if (gLeaf.right == null)
  16.                 {
  17.                     if (gLeaf.left.depth >=2)
  18.                     {
  19.                         RotateRight(gLeaf);
  20.                         // return true;
  21.                     }                  
  22.                 }
  23.                 else
  24.                 {
  25.                     if (gLeaf.left.depth - gLeaf.right.depth > 1)
  26.                     {
  27.                         RotateRight(gLeaf);
  28.                         // CheckStability(gLeaf.parent);
  29.                     }
  30.                     else if (gLeaf.right.depth - gLeaf.left.depth > 1)
  31.                     {
  32.                         RotateLeft(gLeaf);
  33.                         //  CheckStability(gLeaf.parent);
  34.                     }
  35.  
  36.                 }
  37.  
  38.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement