The feature of this series of blogs is--give the results of each order
Originally wanted to write a good process, get a picture of what, but think online analysis too much, are better, so these blog even if it is a summary of their own it.
#include <stdio.h>void selectsort (int *m, int n) {int i,j,k,temp;bool flag;for (i=0;i<n-1;i++) {k=i;flag=true; for (j=i+1;j<n;j++) if (M[j]<m[k]) k=j;if (k!=i) {flag=false;temp=m[k];m[k]=m[i];m[i]=temp;} for (int t=0;t<10;t++) printf ("%d", m[t]);p rintf ("\ n"), if (flag) return;}} int main () {int i;int a[10]={2,6,5,1,4,3,7,8,9,10};for (i=0;i<10;i++) printf ("%d", A[i]);p rintf ("\ n \ n"); Selectsort (a,10);p rintf ("\ n final result \ n"), for (i=0;i<10;i++) printf ("%d", A[i]);p rintf ("\ n"); return 0;}
Run results
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6C/25/wKiom1VAnz2ApAevAAEi05Z4Arg180.jpg "title=" 1.jpg " alt= "Wkiom1vanz2apaevaaei05z4arg180.jpg"/>
This article is from the "hacker" blog, make sure to keep this source http://anglecode.blog.51cto.com/5628271/1640418
Sorting Algorithm Big Collection _ Select Class--select sort directly