摘要: /*——1——*/ void quick_sort(int a[], int left, int right){ if (left < right) { /* at the beginning, we could choose any element as a pivot element*/ /* 阅读全文
posted @ 2016-12-18 09:45 z_Vincent 阅读(172) 评论(0) 推荐(0)
摘要: /*crate a new array to put the elements sorted*/void MergeSort(int a[], int n){ int *TmpArray; TmpArray = (int*)malloc(n*sizeof(int)); if (TmpArray != 阅读全文
posted @ 2016-12-17 22:48 z_Vincent 阅读(170) 评论(0) 推荐(0)
摘要: void Insertsort(int a[], int n){ int i, j; int Tmp; for (i = 1; i < n; i++)//from the second element for (j = i - 1; j >= 0 && a[j] > a[j + 1]; j--){ 阅读全文
posted @ 2016-12-17 22:26 z_Vincent 阅读(109) 评论(0) 推荐(0)
摘要: 代码: void HeapSort(int a[], int n){ int Tmp; for (int i = n / 2; i >= 0; i--) PercDown(a, i, n); /*build a heap; we should know that intinially we put 阅读全文
posted @ 2016-12-17 22:18 z_Vincent 阅读(133) 评论(0) 推荐(0)