A[i], A[perm[next]] = A[perm[next]], A[i]
How about creating a temporary to store the replaced element instead of storing it in A[i]?
It seems so confusing to me while it.
A[i], A[perm[next]] = A[perm[next]], A[i]
How about creating a temporary to store the replaced element instead of storing it in A[i]?
It seems so confusing to me while it.