摘要: 基本思想:首先,选出最小的数,放在第一个位置;然后,选出第二小的数,放在第二个位置;以此类推,直到所有的数从小到大排序 阅读全文
posted @ 2016-07-27 11:26 风雨缠舟 阅读(185) 评论(0) 推荐(0) 编辑
摘要: #include #include //二分插入排序法 void BinsertSort(int a[],int n){ int low,high,mid; int i,j,temp; for(i=0;i=high+1;j--){//high+1也要yi走,让其闲置 a[j+1]=a[j]; } a[j]=temp;... 阅读全文
posted @ 2016-07-27 10:54 风雨缠舟 阅读(1885) 评论(0) 推荐(0) 编辑
摘要: #include #include void QuikSort(int a[],int m,int n){ //第一个数作为关键字,比他大的放到他后面,比他小的放到他前面,分为两个子序列,然后对这两个子序列分别重复这个操作 int low=m; int high=n; int temp=a[low]; //开始这里我直接写成了temp=a[0]导致只要第一个数比后... 阅读全文
posted @ 2016-07-27 10:18 风雨缠舟 阅读(163) 评论(0) 推荐(0) 编辑