Finding the suitable position in the array to swap with found i for which arr [ i ] = i
if ( pos != 0 ) : NEW_LINE INDENT for i in range ( 1 , n ) : NEW_LINE INDENT if ( pos != i ) : NEW_LINE DEDENT DEDENT