text: Starting from rightmost element , insert all elements one by one in an AVL tree and get the count of smaller elements
code: for ( i = n - 1 ; i >= 0 ; i -- ) { root = insert ( root , arr [ i ] , & countSmaller [ i ] ) ; } }