标签:ati 浮动 qsort 利用 ora class 数组 efi type
这个快速排序主要利用递归调用,数组存储方式。包含3个文件,头文件QuickSort.h,库函数QuickSort.c,测试文件TestQuickSort。
其中Cutoff可以自己给定,这个当开始给定的数组(或者递归调用产生的子数组)的元素个数<=20个时,采用插入排序。一般认为当元素个数<=20时,插入排序更快。这个20不是固定的,在这附近浮动都可以的。
头文件QuickSort.h
1 #ifndef QuickSort_H 2 #define QuickSort_H 3 #define Cutoff 20 4 typedef float ElementType; 5 ElementType Median3(ElementType A[], int left, int right); 6 void Swap(ElementType *p, ElementType*q); 7 void InsertionSort(ElementType A[], int N); 8 void QuickSort(ElementType A[], int N); 9 void Qsort(ElementType A[], int Left, int Right); 10 void PrintMatrix(ElementType A[], int N); 11 12 #endif // !QuickSort_H
标签:ati 浮动 qsort 利用 ora class 数组 efi type
原文地址:http://www.cnblogs.com/xinlovedai/p/6229555.html