- 博客(4)
- 资源 (1)
- 收藏
- 关注
原创 直接插入排序算法
一、作者思路:二、我的理解:三、程序流程图:四、c++代码:#include //Sort is a class which includes a simple algorithm:InsertSort() class Sort { private: int *list; int length; public: //Initialize the list and the length of the list Sort() { std::cout>length;
2011-05-22 21:47:00
1372
原创 简单选择排序的算法实现
#include#define n 10int Selectminkey(int *r,int i){ int j=i,min=r[i]; for(i;i<=n;i++) { if(min>r[i]) { min=r[i]; j=i; }//if }//for return j;}//Selectminkeyvoid
2009-12-29 11:40:00
489
原创 希尔排序的算法实现
#include#define n 10void Shellinsert(int *r,int dk) //希尔一趟增量为dk的插入排序{ int i,j; for(i=dk+1;i<=n;i++) if(r[i]<r[i-dk]) { r[0]=r[i]; for(j=i-dk;j>0&&(r[0]<r[j]);j-=dk) r[j+
2009-12-27 20:30:00
279
原创 快速排序算法的实现
#include#define n 10 //定义数字的长度int Partition(int *r,int low,int high) //一趟快速排序{ r[0]=r[low]; while(low<high) { while(low=r[0]) --high; r[low]=r[high]; while(low<high&&r[low]<=r[0
2009-12-27 16:21:00
389
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人