@niloyy2012
Actually what's happening is Time complexity of Avl tree is O(log( no of nodes in the tree ))
here when we insert a new node into the tree then no of nodes become n+1 as already n nodes are present in the tree so when inserting second node of n^2 nodes we need time complexity of O(log( no of nodes in the tree )) which is O( log ( n + 1) )
like wise when inserting third node we require time complexity of O( log ( n + 2) ) as no of nodes became n + 2
finally Total time required = O( log ( n*(n+1)*(n+2)*....*(n+n^2-1) ) )
For last node Time complexity will be O( n + n^2 - 1 ) because no of nodes present in the tree at the time of inserting last node is n + n^2 - 1 so time complexity = O(log( no of nodes in the tree )) = O( log ( n + n^2 - 1 ) )