1 votes 1 votes The tree given is as follows: 40 / \ 35 53 / \ 20 60 How many rotations are required for insertion of elements 30,55,45,65,42 in above tree. (A) 2 (B) 3 (C) 4 (D) None of these DS data-structures avl-tree + – GateAspirant999 asked Apr 23, 2016 GateAspirant999 3.8k views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply ManojK commented Apr 23, 2016 reply Follow Share 3 rotation 1 votes 1 votes shivanisrivarshini commented Apr 23, 2016 reply Follow Share I think none of these 0 votes 0 votes GateAspirant999 commented Apr 23, 2016 reply Follow Share Counting 2 for double rotations, and 1 for single rotation, how many rotations you needed to create valid AVL tree? 0 votes 0 votes Please log in or register to add a comment.
Best answer 3 votes 3 votes Option D None of these shivanisrivarshini answered Apr 23, 2016 • selected Apr 23, 2016 by GateAspirant999 shivanisrivarshini comment Share Follow See all 3 Comments See all 3 3 Comments reply GateAspirant999 commented Apr 23, 2016 reply Follow Share u seem to have mistakenly changed 20 to 25 in right rotation after inserting 30. So your count is 5 rotations in total, right? 0 votes 0 votes shivanisrivarshini commented Apr 23, 2016 reply Follow Share yeah sry i did mistake but i got 5 rotations and i will edit it thanks 0 votes 0 votes Prannav Krishna commented Aug 9, 2017 reply Follow Share How is the last rotation RL ? its unbalanced at node 53 and the inserted node 42 is LEFT child of LEFT subtree . So shouldnt it be a LL rotation? 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes 1st rotation will be LR rotation 2nd will be RL rotation 3rd will be LL rotation 3 rotations will be required.... Arpit Tripathi answered Apr 23, 2016 Arpit Tripathi comment Share Follow See all 2 Comments See all 2 2 Comments reply GateAspirant999 commented Apr 23, 2016 reply Follow Share So each of LR, RL are actually 2 rotations and LL is 1. That means it should be 5 right? 3 votes 3 votes Arpit Tripathi commented Apr 24, 2016 reply Follow Share yes answer is 5 none of these. 1 votes 1 votes Please log in or register to add a comment.
0 votes 0 votes Answer is :B] 3 rotations => LR, RL, LL Desert_Warrior answered Jun 5, 2016 Desert_Warrior comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes It requires 3 Rotation which are which are LL and RR and with combination of Lr and RL we will get a total of % rotation. actually in Question they should give which rotation has to be performed. vishwa ratna answered Feb 11, 2017 vishwa ratna comment Share Follow See all 0 reply Please log in or register to add a comment.