Find the invariant

Can someone help me finding the invariant of the following algorithm: The swap function:

It asks for some more text but I don't know what to write

 void swap (int v[], int i, int j) {
 int t = v[i]; 
 v[i] = v[j];
 v[j] = t;
    }
int what (int A[], int N)

{ int i, j;

  i = -1;

  for (j=0 ; j<N ; j++) 

    if (A[j]%2 != 0) {

      i++;

      swap(A, i, j);

    }

  return i+1;

}  


from Recent Questions - Stack Overflow https://ift.tt/3usqcXl
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)