文件名称:ksps
介绍说明--下载内容均来自于网络,请自行研究使用
首先,初始化将要排序的序列,以数组初始化。
第二,定义快速排序函数:
本算法思路为:在待排序的n个记录中任取一个记录r(通常取第一个记录),以该记录的关键字k为准,将所有剩下的n-1个记录分割成两个子序列。第一个子序列中的每个记录关键子均小于或等于k,第二个子序列中的每个记录关键字均大于或等于k,然后将k对应的记录排在第一个子序列之后及第二个子序列之前。这个过程为一遍排序。之后分别对子序列1和子序列2重复上述过程,直至每个子序列只有一个记录为止。
最后,定义main函数,引用之前定义函数完成程序。
-First, initialize will be the order of sequence, to initialize the array. Second, the definition of Quick Sort function : the algorithm ideas : In order to the n records from a record-r (usually from the first record). for the record, whichever is the keyword k, all the remaining n-a record divided into two sequences. The first sub-sequences of key-each record is less than or equal to k, The second sub-series record of each keyword is greater than or equal to k, Then k corresponding record with the first sub-sequence after sequence and the second sub before. The process of sorting out. After a series respectively tend sequences and two repeat this process until each sub-series so far only one record. Finally, the definition of main function, a function used before the procedure.
第二,定义快速排序函数:
本算法思路为:在待排序的n个记录中任取一个记录r(通常取第一个记录),以该记录的关键字k为准,将所有剩下的n-1个记录分割成两个子序列。第一个子序列中的每个记录关键子均小于或等于k,第二个子序列中的每个记录关键字均大于或等于k,然后将k对应的记录排在第一个子序列之后及第二个子序列之前。这个过程为一遍排序。之后分别对子序列1和子序列2重复上述过程,直至每个子序列只有一个记录为止。
最后,定义main函数,引用之前定义函数完成程序。
-First, initialize will be the order of sequence, to initialize the array. Second, the definition of Quick Sort function : the algorithm ideas : In order to the n records from a record-r (usually from the first record). for the record, whichever is the keyword k, all the remaining n-a record divided into two sequences. The first sub-sequences of key-each record is less than or equal to k, The second sub-series record of each keyword is greater than or equal to k, Then k corresponding record with the first sub-sequence after sequence and the second sub before. The process of sorting out. After a series respectively tend sequences and two repeat this process until each sub-series so far only one record. Finally, the definition of main function, a function used before the procedure.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
压缩包 : 101259380ksps.rar 列表 ksps.cpp