GATE CSE
First time here? Checkout the FAQ!
x
+2 votes
52 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.6k points)   | 52 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 May 2017
  1. akash.dinkar12

    3568 Points

  2. pawan kumarln

    2206 Points

  3. Bikram

    1940 Points

  4. sh!va

    1682 Points

  5. Arjun

    1650 Points

  6. Devshree Dubey

    1272 Points

  7. Debashish Deka

    1270 Points

  8. Angkit

    1056 Points

  9. LeenSharma

    1028 Points

  10. Arnab Bhadra

    904 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 May 22 - 28
  1. Bikram

    1026 Points

  2. pawan kumarln

    832 Points

  3. Arnab Bhadra

    818 Points

  4. akash.dinkar12

    448 Points

  5. Arjun

    378 Points


22,897 questions
29,213 answers
65,336 comments
27,713 users