- Code: Select all
/*
Name: Flip Sort
Number: 10327
Type : sorting
Process : ON
Author :Salman Zaman
Email : zamansalman@gmail.com
Date : 02/06/05 01:27
*/
#include<stdio.h>
//#include<conio.h>
int main(){
int input[2000]={0};
int n,i,temp,j,count;
// freopen("10327.txt","r",stdin);
while(scanf("%d",&n)!=EOF){
for(i=1;i<=n;i++){
scanf("%d",&input[i]);
}
count=0;
for(i=1;i<=n-1;i++){
for(j=i;j<=n;j++){
if(input[i]>input[j]){
temp=input[i];
input[i]=input[j];
input[j]=temp;
count++;
}
}
}
printf("Minimum exchange operations : %d\n",count);
}
//getch();
return 0;
}
Some one please help.

