complete-intro-to-computer-science
complete-intro-to-computer-science copied to clipboard
AVL tree rotation clarification
Hello,
In your lecture on the AVL tree for the rotation phase you give the following steps to follow:
-> swap the values of nodes A and B
-> make node B the left child of node A
-> make node C the right child of node A
-> move node B's right child to its left child
(in this case they're both null)
-> make node A's _original_ left child
(which was null in this case) the left child of node B
-> update the heights of all the nodes involved
I would like to pose a question about (in this case they're both null) claim since I believe that the right child of B is actually C. By making the left child right, I see the change as meaning 'C has been assigned as a right child to A, hence it must be removed as the right child of B (i.e. making both left and right null for B).'
Is my assumption correct?
Best regards!