retagged by
1,489 views
1 1 vote

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

2 Answers

Best answer
2 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
Position:
Show:

Related questions

10 10 votes
1 1 answer
361
361 views
6 6 votes
1 1 answer
207
207 views
6 6 votes
1 1 answer
314
314 views
GO Classes asked Jul 24
314 views
Given the following AVL tree, delete node $\text{A}$.How many rotations are required to rebalance the AVL tree after deleting node $A$?(Count each rotation only once, whe...
5 5 votes
1 1 answer
219
219 views