Closed chloeslam closed 3 years ago
@chloeslam after left-rotate on (1), the tree becomes left-linear as the top-left figure. then perform right-rotate on (3) would give the figure in the center.
So after the left-rotate on (1), (3) will no longer be connected to (1)? Because the figure in the center has (3) connected to (2) and no longer connected to (1), but I thought these only require rotations and no breaking of connectivity.
Oh nevermind, I understand it now. Thank you!
Balanced BST Lecture
I tried drawing out the rotations for the left and right zig-zag conditions, but I can't understand how we can only perform rotations to get the zig-zag conditions to be balanced. Attached to this issue is a picture of my problem. Can someone please explain how the connectivity does not need to be rearranged?