AVL Tree rebalancing logic, single and double rotations, test cases, comprehensive invariant checks