Algorithms_InsertSort
//a algorithm of sort which is easier than a smile,but it makes me cry sometimes... #include "stdio.h" #define N 10 void InsertSort(int a[N],int n); int a[]={12,3,3,455,3,4,34,5,5,34}; void main() { for(int i=0;i < N; N;i++) printf("%d ",a[i]); printf("\n"); InsertSort(a,N); for(i=0;i < N;i++) printf("%d ",a[i]); printf("\n"); } void InsertSort(int a[N],int n) { int t; for (int i=1;i < N;i++) { int j = i; t=a[i]; while (j>0 && t<a[j-1]) { a[j]=a[j-1]; j--; } a[j]=t; } }