Here "j" loop will run "n-1" times and for "while" loop suppose you reach upto j=n and A[n] = smallest of all the value array so we have to go checcking from A[N-1] to A[1] therefore in worst case inner loop will run "n-1" time.
so in worst case time complexity will be O( (n-1)(n-1) ) = O(n2).