The Gateway to Computer Science Excellence
+7 votes
4.2k views

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

  1. $0$
  2. $1$
  3. $2$
  4. $3$
in DS by Boss (30.8k points) | 4.2k views

2 Answers

+16 votes
Best answer

Answer is D] 3

Rotations are : LL LL RR 

by Loyal (8.1k points)
selected by
0

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.

0
Answer edited. Thanks
+3 votes
Number of rotation = 3

Following are the roatation

1. LL

2 LL

3.RR
by Loyal (9.9k points)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,324 answers
198,405 comments
105,169 users