retagged by
901 views
1 votes
1 votes

Delete the key sequence [6,5,4] from the below AVL tree. How many rotations are needed to make it balanced AVL tree again?

retagged by

2 Answers

Best answer
2 votes
2 votes

delete 6 - no rotation is required 

delete 5 - tree will be like           3

                                              1                    4

                                         0         2

          at this point tree is balanced now  delete 4

delete 4  root become unbalanced it will rotate to the right. 

tree will become like :

                                         1

                                  0                    3

                                                  2

So only one rotation is needed.

selected by

Related questions

3 votes
3 votes
1 answer
1