摘要:
#include void shellsort(int a[], int n, int delt){ int i; for(i = delt; i+delt <= n; i ++) { int temp = a[i]; int j = i - delt; while(temp < a[j]) { a[j + delt] = a[j]; j = j - delt; } a[j + delt] = temp; }}void mainsort(int a[], int n, int delt[], int r){ int i; for(i = 0; i < r... 阅读全文
摘要:
july大神博客上的一个特别简便的实现方法void quicksort(int l, int u){ int i, m; if (l >= u) return; swap(l, randint(l, u)); m = l; for (i = l+1; i int main(void){ int i; int j; int temp; int a[4] = {5, 3, 6, 2};// bubblesort(a, 4); for(i = 0; i a[j+1]) { temp = a[j];... 阅读全文