Question
Write a program that implements this simple transpositionsort: for (i = 0; i <SIZE;++i) for (j=i+ 1; j < SIZE; ++j) if(a[i] > a[j]) swap(&a[i], &a[j]); After your program is working, modify it so that all theelements of the array are printed after each pass of the outerloop. Suppose, for example, that the size of your array is 8 andits starting values are 7 3 66 3 -5 22 -77 2 Your program should print the following on the screen: Unordered data: 7 3 66 3 -5 22 -77 2 After pass 1: -77 7 66 3 3 22 -5 2 After pass 2: -77 -5 66 7 3 22 3 2 ..... Write a program that implements this simple transpositionsort: for (i = 0; i <SIZE;++i) for (j=i+ 1; j < SIZE; ++j) if(a[i] > a[j]) swap(&a[i], &a[j]); After your program is working, modify it so that all theelements of the array are printed after each pass of the outerloop. Suppose, for example, that the size of your array is 8 andits starting values are 7 3 66 3 -5 22 -77 2 Your program should print the following on the screen: Unordered data: 7 3 66 3 -5 22 -77 2 After pass 1: -77 7 66 3 3 22 -5 2 After pass 2: -77 -5 66 7 3 22 3 2 .....
Explanation / Answer
please rate - thanks #include #include void swap(int *,int *); int main( ) { int a[8],SIZE=8,i,j,k; for(i=0;i