title: How to easily remember Red-Black Tree insert and delete?
body: <p>It is quite easy to fully understand standard Binary Search Tree and its operations. Because of that understanding, I even don't need to remember the implementations of those insert, delete, search operations.</p>
  
  <p>I am learning Red-Black Tree now and I understand its properties for keeping the tree balanced. However I feel very hard to understand its insert and delete procedures. </p>
  
  <p>I understand when inserting a new node, we mark the node as red (because red is the best we can do to avoid breaking less Red-Black tree laws). The new red node may still break the "no continuous red nodes law". Then we fix it via:</p>
  
  <ol>
  <li><p>check its uncle's colour, if red, then mark its parent and uncle as black, and go to grandparent.</p></li>
  <li><p>if it is right child, left rotate its parent</p></li>
  <li><p>mark its parent as black and its grandparent as red, then right rotate its grandparent. </p></li>
  </ol>
  
  <p>done (basically like above).</p>
  
  <p>Many places describes Red-Black tree's insert like above. They just tell you how to do it. But why those steps can fix the tree? Why first left rotate, and then right rotate?</p>
  
  <p>Can anyone explains why to me more clearly, even more clear than CLRS? What's the magic of rotation?</p>
  
  <p>I really wish to understand so after 1 year, I can implement Red-Black tree by myself without review a book.</p>
  
  <p>Thanks </p>