arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 1209.4714cs.DS
收藏

使用改进的原地关联排序对不同整数进行排序

Sorting distinct integers using improved in-place associative sort

A. Emre Cetin

摘要:

针对整数表,提出了原地关联整数排序技术,该技术仅需要常量的额外内存,取代了桶排序、分布计数排序和地址计算排序算法族。然后,进一步改进了该技术,提出了一种原地排序算法,其中n个整数S[0... n-1]中的每一个都在范围[0,n-1]中精确排序,而前一种技术的复杂度是递归T(n)= T(n/2)+ O(n),产生T(n)= O(n)。该技术有两个变体,一个用于只读的不同整数键,另一个用于可修改的不同整数。假设w是固定的字长,用于可修改的不同整数的变体能够对n个不同整数S[0..进行排序。n-1],如果m <(w-logn)n,则时间复杂度为O(n)。否则,它在O(n + m/(w-logn))时间内对最坏情况进行排序,O(m/(w-logn))时间用于平均值(均匀分布的密钥),O(n)时间用于最好情况,仅使用O(1)额外空间。本文改进了可修改的不同整数的变式,得到了一个对n个不同整数S[0... n-1],如果m <(w-1)n,则时间复杂度为O(n)。否则,它在O(n + m/(w-1))时间内对最坏情况进行排序,O(m/(w-1))时间用于平均值(均匀分布的密钥),O(n)时间用于最好情况,仅使用O(1)额外空间。

英文摘要:

In-place associative integer sorting technique was proposed for integer lists which requires only constant amount of additional memory replacing bucket sort, distribution counting sort and address calculation sort family of algorithms. Afterwards, the technique was further improved and an in-place sorting algorithm is proposed where n integers S[0...n-1] each in the range [0, n-1] are sorted exactly in O(n) time while the complexity of the former technique was the recursion T(n) = T(n/2) + O(n) yielding T(n) = O(n). The technique was specialized with two variants one for read-only distinct integer keys and the other for modifiable distinct integers, as well. Assuming w is the fixed word length, the variant for modifiable distinct integers was capable of sorting n distinct integers S[0...n-1] each in the range [0, m-1] in exactly O(n) time if m < (w-logn)n. Otherwise, it sort in O(n + m/(w-logn)) time for the worst, O(m/(w-logn)) time for the average (uniformly distributed keys) and O(n) time for the best case using only O(1) extra space. In this study, the variant for modifiable distinct integers is improved and an algorithm is obtained that sorts n distinct integers S[0...n-1] each in the range [0, m-1] in exactly O(n) time if m < (w-1)n. Otherwise, it sort in O(n + m/(w-1)) time for the worst, O(m/(w-1)) time for the average (uniformly distributed keys) and O(n) time for the best case using only O(1) extra space.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑