Sign in to follow this  

AVL Trees

This topic is 3316 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im working on an AVL tree for my data structures class. i have the all of the rotations implemented such as slr, srr, dlr, and drr. i can detect slr and srr rotations easily when inserting numbers. im having a hard time figuring out when to do dlr and drr. can anybody help me out? thanks

Share this post


Link to post
Share on other sites
Take a look at this page. Essentially, it boils down to these rules:

If your tree is unbalanced to the right and the right child is right-heavy, you need a SLR.
If your tree is unbalanced to the right and the right child is left-heavy, you need a DRR.
If your tree is unbalanced to the left and the left child is left-heavy, you need a SRR.
If your tree is unbalanced to the left and the left child is right-heavy, you need a DLR.

Share this post


Link to post
Share on other sites

This topic is 3316 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this