摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>#define MAX 100void insertSort(char *arr, int total){ int i,j,pos; char temp; for(i=1;i<total;i++){ j = i-1; temp = arr[i]; while(j>=0 && temp < arr[j]){ arr[j+1] = arr[j]; j--; } ... 阅读全文
posted @ 2012-09-26 23:34 ﹏Sakura 阅读(287) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>#define MAX 100void selectSort(char *arr, int total){ int i,j,pos; char temp; for(i=0;i<total-1;i++){ pos = i; //此处需注意每次排序是一定要给pos 赋值 否则当不交换变量时会有BUG temp = arr[pos]; for(j=i+1;j<total;j++){ i... 阅读全文
posted @ 2012-09-26 00:36 ﹏Sakura 阅读(245) 评论(0) 推荐(0) 编辑