⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sort.cwp.lib

📁 su 的源代码库
💻 LIB
字号:
SORT - Functions to sort arrays of data or arrays of indiceshpsort		sort an array of floats by the heap sort methodqkisort		sort an array of indices i[] so that 		a[i[0]] <= a[i[1]] <= ... <= a[i[n-1]]		uses the "quick sort" methodqkifind		partially sort an array of indices i[] so that the 		index i[m] has the value it would have if the entire		array of indices were sorted such that 		a[i[0]] <= a[i[1]] <= ... <= a[i[n-1]]		uses the "quick sort" methodqksort		sort an array of floats such that a[0] <= a[1] <= ... <= a[n-1]		uses the "quick sort" methodqkfind		partially sort an array of floats  so that the element a[m] has		the value it would have if the entire array were sorted		such that a[0] <= a[1] <= ... <= a[n-1]		uses the "quick sort" methodFunction Prototypes:void hpsort (int n, float a[]);void qkisort (int n, float a[], int i[]);void qkifind (int m, int n, float a[], int i[]);void qksort (int n, float a[]);void qkfind (int m, int n, float a[]);hpsort:Input:n		number of elements in aa		array[n] to be sortedOutput:a		array[n] sortedqkisort:Input:n		number of elements in array aa		array[n] elementsi		array[n] indices to be sortedOutput:i		array[n] indices sortedqkifind:Input:m		index of element to be foundn		number of elements in array aa		array[n] elementsi		array[n] indices to be partially sortedOutput:i		array[n] indices partially sorted sortedqksort:Input:n		number of elements in array aa		array[n] containing elements to be sortedOutput:a		array[n] containing sorted elementsqkfind:Input:m		index of element to be foundn		number of elements in array aa		array[n] to be partially sortedOutput:a		array[n] partially sortedNotes:hpsort:The heap sort algorithm is, at worst, N log_2 N, and in most casesis 20% faster.  Adapted from Standish.qkisort, qkifind, qksort, qkfind:n must be less than 2^NSTACK, where NSTACK is defined above.qkisort:This function is adapted from procedure quicksort byHoare, C.A.R., 1961, Communications of the ACM, v. 4, p. 321;the main difference is that recursion is accomplishedexplicitly via a stack array for efficiency; also, a simpleinsertion sort is used to sort subarrays too small to bepartitioned efficiently.qkifind:This function is adapted from procedure find byHoare, C.A.R., 1961, Communications of the ACM, v. 4, p. 321.qksort:This function is adapted from procedure quicksort byHoare, C.A.R., 1961, Communications of the ACM, v. 4, p. 321;the main difference is that recursion is accomplishedexplicitly via a stack array for efficiency; also, a simpleinsertion sort is used to sort subarrays too small to bepartitioned efficiently.qkfind:This function is adapted from procedure find by Hoare 1961.Reference:hpsort:Standish, T. A., Data Structure Techniques, p. 91.See also Press, W. A., et al., Numerical Recipes in C.quick sort:Hoare, C.A.R., 1961, Communications of the ACM, v. 4, p. 321.Author:  Dave Hale, Colorado School of Mines, 12/26/89

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -