retagged by
564 views

1 Answer

Best answer
3 votes
3 votes

To create an AVL tree , we have to insert n elements into it.And we know that cost of insertion in a balanced tree = O(logn)

Therefore total complexity = O(nlogn)

To be more accurate mathematically , 

No. of operations involved = log1 + log2 + log3 ..+logk ...+ logn [ Since for balanced tree of k nodes , cost of insertion = O(logk)]

                                      = log (1.2.3....n)

                                      = log n!

By Stirling's approximation , we know

log n! = O(nlogn)

Therefore , the complexity of building an AVL tree is O(nlogn)

For reference, you may visit :

http://stackoverflow.com/questions/17629668/difference-between-the-time-complexity-required-to-build-binary-search-tree-and

selected by

Related questions

1 votes
1 votes
1 answer
1
kd..... asked Apr 13, 2019
798 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,080 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
696 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,981 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...