Gadgets 4 Students Career Guide Free Tutorials  Go to Your University  Placement Preparation 
0 like 0 dislike
550 views
in Challenge Questions by Goeduhub's Expert (9.3k points)

1 Answer

1 like 0 dislike
by (124 points)

In Avl tree , generally there are two types of rotation.

1. Right Rotation 

2. Left Rotation 

Right Rotation: When balancing factor of node in a tree is more than +1 , we need to rotate tree in right direction. 

Algorithm: Right Rotation  [Rotation along node P]

Step 1. Begin 

Step 2. Set  q=p -> Left 

Step 3. Set hold = q -> Right 

Step 4. Set q -> right =p

Step 5. Set p -> Left = hold

Step 6. Return 

Left Rotation: When balancing factor  of a node is less than -1 , we need to rotate it in left direction. 

Algorithm: Left Rotation [Rotation along node P]

Step 1. Begin 

Step 2. Set 1 = p -> right 

Step 3. Set hold = q -> left 

Step 4. Set q -> left = p

Step 5. Set p -> right =hold 

Step 6. Return 

Learn & Improve In-Demand Data Skills Online in this Summer With  These High Quality Courses[Recommended by GOEDUHUB]:-

Best Data Science Online Courses[Lists] on:-

Claim your 10 Days FREE Trial for Pluralsight.

Best Data Science Courses on Datacamp
Best Data Science Courses on Coursera
Best Data Science Courses on Udemy
Best Data Science Courses on Pluralsight
Best Data Science Courses & Microdegrees on Udacity
Best Artificial Intelligence[AI] Courses on Coursera
Best Machine Learning[ML] Courses on Coursera
Best Python Programming Courses on Coursera
Best Artificial Intelligence[AI] Courses on Udemy
Best Python Programming Courses on Udemy

Related questions

1 like 0 dislike
0 answers 241 views
1 like 0 dislike
1 answer 450 views
0 like 0 dislike
0 answers 206 views
1 like 0 dislike
1 answer 291 views

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy ||  Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 

 

Free Online Directory

...