Thursday 6 October 2016

The number of rotations required to insert a sequence of elements 9,6,5,8,7,10 into an empty AVL tree is? | ISRO | 2013

The number of rotations required to insert a sequence of elements 9,6,5,8,7,10 into an empty AVL tree is?

A. 0
B. 1
C. 2
D. 3

Solution :-

Answer is D : 3
Rotations are : LL LL RR

Explation :-

Last one should be RR, because node 6 got unbalanced just because of addition of 10 in the right subtree of right child of node 6.

3 comments: