Hello everybody!

I would like to ask some help regarding one swap algorithm I am doing. The algorithm need to swap all elements of the array with every possible combination of the elements of it. I am stuck trying to get the best possible time complexity for this algorithm, but I cannot do better than O(N raised to 2). I am running out of ideas. The algorithm I have is the following:

Code:

import java.math.*;
class SwapAlgo {
public int main(int[] A) {
int l=0,k=0;
//Swap algorithm
for (l=0 ; l < A.length ; l++){
for (k = l+1 ; k < A.length ; k++){
int [] A_aux = A;
int num_aux = A_aux[l];
A_aux [l] = A_aux[k];
A_aux[k]=num_aux;
}
}
}

My question is, is there any swap algorithm with better time complexity? In this case O(N).

Thank you very much!