Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVL tree rotation clarification #33

Open
drumenov opened this issue Mar 17, 2022 · 0 comments
Open

AVL tree rotation clarification #33

drumenov opened this issue Mar 17, 2022 · 0 comments

Comments

@drumenov
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant