SHARE
TWEET

Untitled

a guest Oct 19th, 2017 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private void fixTree(Node<K, V> node)
  2.     {
  3.  
  4.         if (node.getRight().getColour() == "red" && node.getLeft().getColour() != "red")
  5.         {
  6.             node = rotateLeft(node);
  7.         }
  8.  
  9.         if (node.getLeft().getColour() == "red" && node.getLeft().getLeft().getColour() == "red")
  10.         {
  11.             node = rotateRight(node);
  12.         }
  13.  
  14.         if (node.getLeft().getColour() == "red" && node.getRight().getColour() == "red")
  15.         {
  16.             node.makeRed();
  17.             node.getLeft().makeBlack();
  18.             node.getRight().makeBlack();
  19.         }
  20.  
  21.     }
RAW Paste Data
Top