One element takes (log n) time to insert.
What is the rebalancing of the AVL tree's operational complexity?
Insertions and deletions in an AVL tree may need (log n) rotations if the tree was maximum unbalanced before the element was inserted. Because you could conduct O(log n) work per each of the n nodes, rebalancing the tree might take O(n log n) time.
For each element inserted or removed, a rotation will be done
AVL tree is a self-balancing Binary Search Tree (BST) where the ... The height of an AVL tree is always O(Logn)
If there are n elements, N rotations will be conducted in the worst case. If there are n+1 elements, a rotation will be executed for that additional element, i.e N+1 rotations.
N*N rotation is possible for n*n elements.
As a result, it will take (n^2 log n ) time to insert n^2 elements after n elements already exist