Jump to content
  • Advertisement
Sign in to follow this  
adam17

AVL Trees

This topic is 3679 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!