title: Binary search tree left rotation
body: <p>I'm going over rotations and trying to rotate courses that have been to my binary search tree to the left or right depending on what method I call. There is a bug somewhere in my code and I think I've isolated it to the rotation method since everytime I try to print after I successfully do a rotation, it goes into an infinite loop. Is there some type of pointer or call mixup in my method? I feel that my logic is right but can't seem to figure out where the bug is(or even if it's in this method).</p>
  
  <p>Here's my left rotation method:</p>
  
  <pre><code>bool BinarySearchTree::leftRotate(string number)
  {
  Course *x, *y;
  
  if (treeSearch(number) == NULL){
      return false;
  }
  else{
      x = treeSearch(number);
  }
  
  if (x-&gt;getRight() == NULL){
      return false;
  }
  else{
      y = x-&gt;getRight();
      x-&gt;setRight(y-&gt;getLeft());
  }
  
  if (y-&gt;getLeft() != NULL){
      y-&gt;getLeft()-&gt;setParent(x);
  }
  y-&gt;getParent()-&gt;setParent(x);
  
  if(x-&gt;getParent() == NULL){
      root = y;
  }
  else if( x-&gt;getParent()-&gt;getRight() == x){
      x-&gt;getParent()-&gt;setLeft(y);
  }
  else{
      x-&gt;getParent()-&gt;setRight(y);
  }
      y-&gt;setLeft(x);
      x-&gt;setParent(y);
  return true; 
  }
  </code></pre>
  
  <p>Thanks in advance.</p>