Balanced and stabilized quicksort method
    33.
    发明授权
    Balanced and stabilized quicksort method 失效
    平衡稳定的快速排料法

    公开(公告)号:US5535378A

    公开(公告)日:1996-07-09

    申请号:US177289

    申请日:1994-01-04

    申请人: William D. Arnold

    发明人: William D. Arnold

    IPC分类号: G06F7/24 G06F7/08

    CPC分类号: G06F7/24 Y10S707/99931

    摘要: The improved Quicksort method of the present invention utilizes two pointers initialized at opposite ends of the array or partition to be sorted and an initial partition value Pvalue located at the center of the array or partition. The value at each of the end pointers is then compared to Pvalue. Sorting is accomplished by recursing the partition process for the two array segments bounded on one side by the final P valve location. This method prevents excessive recursions, and allows the identical array case to recurse to the ideal minimum: Log2(N). Also, by relaxing the offsider criteria to include elements equal to Pvalue, the present invention presents arrays of two valves or a very small range of valves from recursing excessively. Further, the sorting method of the present invention may test the final position of the initial Pvalue to determine whether it is in the center (75%-95%) portion of the array or subarray being positioned. If it is not, the first Pvalue is disregarded, and a new initial Pvalue is selected, preferably randomly selected from the larger subarray bounded on one side by the final Pvalue location resulting from the initial attempt. This method prevents arrays situated in "pipe organ" sequence from recursing excessively. In addition, a maximum recursion depth limit may be specified to force section of a new initial Pvalue if a recursion level exceeds the depth limit.

    摘要翻译: 本发明的改进的Quicksort方法利用在要排序的阵列或分区的相对端初始化的两个指针和位于阵列或分区的中心的初始分区值Pvalue。 然后将每个结束指针的值与Pvalue进行比较。 排序是通过对最终P阀位置的一侧限定的两个数组段进行递归分割处理来完成的。 此方法可以防止过多的递归,并允许相同的数组大小写递归到理想的最小值:Log2(N)。 此外,通过放松偏移标准来包括等于P值的元件,本发明提供了两个阀的阵列或非常小范围的阀从过度的递减。 此外,本发明的分类方法可以测试初始Pvalue的最终位置,以确定其是否位于阵列或子阵列的中心(75%-95%)部分中。 如果不是,则忽略第一个P值,并且选择新的初始P值,优选地从在一侧限定由初始尝试所得到的最终P值位置的较大子阵列中随机选择。 这种方法防止位于“管风琴”序列中的阵列过度地递归。 此外,如果递归级别超过深度限制,则可以指定最大递归深度限制来强制新的初始P值的部分。