codeinsertSort

#include "stdio.h"
#define N 7
int main(void)
{
  char a[N]="824936";
  int j,i;
  int key;
  for(j=2;j<N-1;j++){
    key=a[j];
    i=j-1;
    while(i>0 && key<a[i]){
      a[i+1]=a[i];   /*a[i+1]=a[j]*/
      --i;
    }
    a[i+1]=key;
  }
  while(--j>-1){
    printf("%c", a[N-1-j]);
  }
  getch();
  return 0;
}
原文地址:https://www.cnblogs.com/qinghao/p/1748908.html