摘要: #include using namespace std; const int MAX = 1001; int l[MAX]; //Heap Sort void HeapAdjust(int s, int m) { int rc = l[s]; for(int j=2*s;j=l[j]) break; l[s]=l[j]; s=j; }... 阅读全文
posted @ 2017-01-05 10:24 KennyRom 阅读(140) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; const int MAX = 10001; int l[MAX]; int Partition(int low, int high) { l[0]=l[low]; int pivotkey=l[low]; while(low=pivotkey) high--; l[l... 阅读全文
posted @ 2017-01-05 09:50 KennyRom 阅读(155) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; const int MAX = 1001; int l[MAX]; void ShellInsert(int n, int dk) { for(int i=dk+1;i0&&l[0]0;k/=2) ShellInsert(n, k); } int main() { int n; cin>>n... 阅读全文
posted @ 2017-01-05 09:34 KennyRom 阅读(142) 评论(0) 推荐(0) 编辑
摘要: //直接插入排序 #include using namespace std; const int MAX = 1001; int l[MAX]; void InsertSort(int n) { int j; for(int i=2;i>n; for(int i=1;i>l[i]; InsertSort(n); for(int i=1;i<=n... 阅读全文
posted @ 2017-01-05 09:02 KennyRom 阅读(146) 评论(0) 推荐(0) 编辑
摘要: Description You know sorting is very important. And this easy problem is: Given you an array with N non-negative integers which are smaller than 10,00 阅读全文
posted @ 2017-01-05 08:02 KennyRom 阅读(292) 评论(0) 推荐(0) 编辑