摘要: int GetNumInPos(int value,int pos); int GetMaxPos(int a[],int n); void RadixSort(int a[],int left,int right); //获得整数value从低位到高位的第pos(1-->)位数值 int GetNumInPos(int value,int pos) { int i; int ... 阅读全文
posted @ 2018-04-17 22:06 蝉鸣的Summer 阅读(918) 评论(0) 推荐(0) 编辑
摘要: void Merge(int a[],int low,int mid,int high); void MergeSort(int a[],int low,int high); //将两个非降序序列low--mid,mid+1--high合并为一个新的非降序序列 void Merge(int a[],int low,int mid,int high) { int len = high-l... 阅读全文
posted @ 2018-04-17 21:45 蝉鸣的Summer 阅读(2377) 评论(0) 推荐(0) 编辑
摘要: void QuickSort(int a[],int low,int high); //对a[low]到a[high]由小到大排序 void QuickSort(int a[],int low,int high) { int pivot; int i=low,j=high; if(low=pivot) //从右往左找到第一个小于枢轴的数 ... 阅读全文
posted @ 2018-04-17 21:36 蝉鸣的Summer 阅读(2867) 评论(0) 推荐(2) 编辑
摘要: void BubbleSort(int a[],int left,int right); //对a[left]到a[right]由小到大排序 void BubbleSort(int a[],int left,int right) { int i,j; int flag; //当一次循环中未发生交换,0标记排序结束 int temp; for(i=right;... 阅读全文
posted @ 2018-04-17 21:33 蝉鸣的Summer 阅读(227) 评论(0) 推荐(0) 编辑
摘要: void ShellSort(int a[],int left,int right); //对a[left]到a[right]从小到大排序 void ShellSort(int a[],int left,int right) { int len = right - left +1; int gap,i,j,temp; //Shell提出的增量选取规则n/2,n/4,..... 阅读全文
posted @ 2018-04-17 21:25 蝉鸣的Summer 阅读(182) 评论(0) 推荐(0) 编辑
摘要: void BinaryInsertionSort(int a[],int left,int right); //对数组a[left]到a[right]段数据从小到大排序 void BinaryInsertionSort(int a[],int left,int right) { int low,middle,high; int temp; int i,j; //... 阅读全文
posted @ 2018-04-17 21:19 蝉鸣的Summer 阅读(520) 评论(0) 推荐(0) 编辑
摘要: void InsertionSort(int a[],int len); /* 算法: */ //由小到大的直接插入排序 direct insertionsort void InsertionSort(int a[],int len) { int i,j; int temp; for(i=1;i=0&&tempa[n-1]},step{1,2,3,..... 阅读全文
posted @ 2018-04-17 21:06 蝉鸣的Summer 阅读(374) 评论(0) 推荐(0) 编辑
摘要: /*由小到大排序*/ void Adjust(int a[],int low,int high); void HeapSort(int a[],int n);//调整大顶堆 //数组从下标0开始存储数据,对下标为low的元素进行调整,右边界下标为high void Adjust(int a[],int low,int high) { int i = low,j = 2*i+1; ... 阅读全文
posted @ 2018-04-17 20:50 蝉鸣的Summer 阅读(230) 评论(0) 推荐(0) 编辑