1 #include <stdio.h> 2 #define N 10 3 //INSERTION-SORT 4 int main() 5 { 6 int i,j,a[N]={5,1,2,3,6,0,4,7,9,8}; 7 int key; 8 for(j=1;j<N;j++) 9 { 10 key=a[j]; 11 i=j-1; 12 while(i>=0&&a[i]>key) 13 { 14 a[i+1]=a[i]; 15 i--; 16 } 17 a[i+1]=key; 18 } 19 for(i=0;i<N;i++) 20 printf("%d",a[i]); 21 return 0; 22 }