文件名称:Quicksort
介绍说明--下载内容均来自于网络,请自行研究使用
快速排序算法基本思想
通过一趟排序将要排序的数据分割成独立的两部分,其中一部分的所有数据都比另外一部分的所有数据都要小,然后再按此方法对这两部分数据分别进行快速排序,整个排序过程可以递归进行,以此达到整个数据变成有序序列。一般设置数组的第一个数为需要比较的值,把整个数组分为小于和大于该数的两部分。
我自己在写这个算法的时候,卡住了好几回,总是边界值出现问题。下面的这个实现加入了注释,希望对你能够有所帮助。-Basic idea of quick sort algorithm to sort through the trip sort of data will be separated into two independent parts, a part of all of the data than another to be a small part of all of the data, and then part of the data here are two methods for rapid sequencing , the sorting process can be recursive, thus achieving the data into an orderly sequence. The first general set of the array for the need to compare the number of values, the entire array is divided into less than and greater than the number of two parts. I write this algorithm in time, stuck several times, always boundary value problems. The following comments added to this realization, I hope you can help.
通过一趟排序将要排序的数据分割成独立的两部分,其中一部分的所有数据都比另外一部分的所有数据都要小,然后再按此方法对这两部分数据分别进行快速排序,整个排序过程可以递归进行,以此达到整个数据变成有序序列。一般设置数组的第一个数为需要比较的值,把整个数组分为小于和大于该数的两部分。
我自己在写这个算法的时候,卡住了好几回,总是边界值出现问题。下面的这个实现加入了注释,希望对你能够有所帮助。-Basic idea of quick sort algorithm to sort through the trip sort of data will be separated into two independent parts, a part of all of the data than another to be a small part of all of the data, and then part of the data here are two methods for rapid sequencing , the sorting process can be recursive, thus achieving the data into an orderly sequence. The first general set of the array for the need to compare the number of values, the entire array is divided into less than and greater than the number of two parts. I write this algorithm in time, stuck several times, always boundary value problems. The following comments added to this realization, I hope you can help.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Quicksort.doc