GATE CSE
First time here? Checkout the FAQ!
x
+2 votes
45 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 Active (2.4k points)   | 45 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 Feb 2017
  1. Arjun

    4704 Points

  2. Bikram

    4004 Points

  3. Habibkhan

    3738 Points

  4. Aboveallplayer

    2966 Points

  5. sriv_shubham

    2278 Points

  6. Smriti012

    2212 Points

  7. Arnabi

    1814 Points

  8. Debashish Deka

    1788 Points

  9. sh!va

    1444 Points

  10. mcjoshi

    1444 Points

Monthly Topper: Rs. 500 gift card

20,788 questions
25,938 answers
59,535 comments
21,929 users