Jump to content
  • Advertisement
Sign in to follow this  
adam17

AVL Trees

This topic is 3623 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!