recategorized by
972 views

2 Answers

Best answer
13 votes
13 votes

In case of insertion , while inserting in an AVL tree , maximum 1 imbalance will occur hence maximum of two rotations(in case it is LR or RL imbalance)..Hence it is O(1)..

In case of deletion , while deleting in an AVL tree ,we have to fix imbalance at each level in the worst case and max of 2 rotations at each level , so no of rotations that are needed in worst case  =  2logn  = O(logn)..

Hence the given statement should be false.

selected by
0 votes
0 votes

well I concluded it as follows-

height of AVL tree cannot be more than atmost 1.44logn i.e. O(log n) if there are n nodes. So if for the height (log n) tree is unbalanced, there is need of atleast 1 rotation. similarly for height (log n -1) there is need for 1 rotation.. and so on

so for height (log n)   atleast 1 rotation

for height (log n-1)    atleast  1 rotation

for height (log n-2)    atleast  1 rotation

for height (log n-3)    atleast  1 rotation

.

.

.

.

for height (log n    -n)    atleast  1 rotation

thus total rotations 1+1+1+1+1+1…..+1  =  n 

and average rotations  n/n= 1 (assume this as some constant k)

therefore there can be average of K rotations.

so statement is false

Related questions

1 votes
1 votes
1 answer
1
kd..... asked Apr 13, 2019
792 views
here what to do first as FIZZA and IMRAN both are unbalanced than either to do RR rotation from FIZZA-IMRAN-NAVEEN or RL rotation from IMRAN-NAVEEN-LOVELY
1 votes
1 votes
1 answer
2
Rahul_Rathod_ asked Dec 28, 2018
1,071 views
what is the maximum possible hight of AVL tree with 54 node?is there any general method to solve this question?
1 votes
1 votes
1 answer
3
Lakshman Bhaiya asked Nov 6, 2018
692 views
The minimum number of node in an AVL Tree of height $10$ is ____________
7 votes
7 votes
9 answers
4
syncronizing asked Sep 15, 2018
8,942 views
The number of different orders are possible for elements 1, 2, 3, 4, 5, 6, 7 to be inserted in to empty AVL tree such that no rotation will be done and element ‘4’ is...