bool duplicate(int A[], int len, int* dup) { for(int i = 0; i < len; i++){ while(A[i] != i){ if(A[A[i]] == A[i]){ *dup = A[i]; return true; }else{ std::swap(A[i], A[A[i]]); ...