GATE CSE
First time here? Checkout the FAQ!
x
+2 votes
48 views

What are we suppose to take?

LR - 2 rotations.
RL-  2 rotations.

OR

LR - 1 rotation.
RL-  1 rotation.

Kindly Solve and Verify the Total Numbers of Rotations Performed.

asked in DS by Loyal (2.5k points)   | 48 views
is it 1LR and 1RL ?
Are you talking about Final Answer?
in total after all insertions i am getting 1RL, 1RR, 1LR.
Well , I am getting

1- RL
1-RL
1-LL
1-LL
In the same sequence in total at the End.
If asked about rotations simply , they should be taken as two as they are double rotation instances..
on 80 insertion no rotation, then atmax 3 [as only 3 insertions after this] should be there how you getting 4 ?
How can you say,@Gate Mission 1?Sir,  Have you tried it?

When you apply 2nd RL , the tree needs to get Rebalanced. And that's why it takes one more.

The answer Given is 5 and that Confuses me.

@jason, 

Use it for visualisation : https://www.cs.usfca.edu/~galles/visualization/AVLtree.html

I am not sir :) ...just an aspirant.

Please log in or register to answer this question.



Top Users Mar 2017
  1. rude

    4008 Points

  2. sh!va

    2984 Points

  3. Rahul Jain25

    2804 Points

  4. Kapil

    2604 Points

  5. Debashish Deka

    2050 Points

  6. 2018

    1406 Points

  7. Vignesh Sekar

    1292 Points

  8. Bikram

    1204 Points

  9. Akriti sood

    1162 Points

  10. Sanjay Sharma

    964 Points

Monthly Topper: Rs. 500 gift card

21,435 questions
26,746 answers
60,901 comments
22,916 users