Case 1 - Right Heavy Tree

Assuming:

  • WBT is right-heavy ()
  • balance by single counter-clockwise rotation.

Proof - Uses Diagram Above

  1. Let
  2. Let
  3. Let
  4. Suppose
  5. Suppose
  6. Consider cases:
    1. Case 1: node added to to cause imbalance
      1. Suppose before addition, we had a WBT
      2. This means,
      3. Suppose before addition, we had a WBT
      4. This means,
      5. WTS: after addition, and rotation, we have a WBT and WBT
      6. In other words, WTS:
        1. (WBT x)
        2. (WBT v)
      7. by 4,5
      8. Then, by 4, 10
      9. by 8.1
      10. , therefore
      11. Note that
      12. Thus, we have shown all cases
    2. Case 2: node removed from to cause imbalance
      1. Suppose before removal, we had a WBT
      2. This means,
      3. Suppose before addition, we had a WBT
      4. This means,
      5. WTS: after removal, and rotation, we have a WBT and WBT
      6. In other words, WTS:
        1. (WBT x)
        2. (WBT )
      7. by 4,5
      8. by 4, 11
      9. by 8.1
      10. by 8.1, 10
      11. when

Case 2 - Left Heavy Tree

When the WBT is left-heavy - single counter-clockwise rotation.