有O(n)的整数排序算法吗?

发布于 2024-08-23 15:17:59 字数 595 浏览 1 评论 0 原文

上周,我偶然发现了这篇论文,其中作者在第二页提到:

请注意,这会产生整数边权重的线性运行时间。

第三页也一样:

这会产生整数边权重的线性运行时间和基于比较的排序的 O(m log n) 时间。

在第 8 页:

特别是,使用快速整数排序可能会大大提高 GPA。

这是否意味着对于整数值在特殊情况下存在 O(n) 排序算法?或者这是图论的一个专业?

PS:
参考文献 [3] 可能会有所帮助,因为在第一页上他们说:

对[..]图类进行了进一步改进,例如整数边权重[3]、[...]

,但我无法访问任何科学期刊。

The last week I stumbled over this paper where the authors mention on the second page:

Note that this yields a linear running time for integer edge weights.

The same on the third page:

This yields a linear running time for integer edge weights and O(m log n) for comparison-based sorting.

And on the 8th page:

In particular, using fast integer sorting would probably accelerate GPA considerably.

Does this mean that there is a O(n) sorting algorithm under special circumstances for integer values? Or is this a specialty of graph theory?

PS:
It could be that reference [3] could be helpful because on the first page they say:

Further improvements have been achieved for [..] graph classes such as integer edge weights [3], [...]

but I didn't have access to any of the scientific journals.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

拥抱没勇气 2024-08-30 15:17:59

是的,基数排序计数排序O(N)。它们不是基于比较的排序,已被证明具有Ω(N log N)下限。

准确地说,基数排序是O(kN),其中k是要排序的值的位数。计数排序的复杂度是O(N + k),其中k是要排序的数字的范围。

在某些特定应用中,k 足够小,基数排序和计数排序在实践中都表现出线性时间性能。

Yes, Radix Sort and Counting Sort are O(N). They are NOT comparison-based sorts, which have been proven to have Ω(N log N) lower bound.

To be precise, Radix Sort is O(kN), where k is the number of digits in the values to be sorted. Counting Sort is O(N + k), where k is the range of the numbers to be sorted.

There are specific applications where k is small enough that both Radix Sort and Counting Sort exhibit linear-time performance in practice.

葬花如无物 2024-08-30 15:17:59

比较排序的平均值必须至少为 Ω(n log n)。

但是,计数排序基数排序随输入大小线性缩放 - 因为它们不是比较排序,所以它们利用输入的固定结构。

Comparison sorts must be at least Ω(n log n) on average.

However, counting sort and radix sort scale linearly with input size – because they are not comparison sorts, they exploit the fixed structure of the inputs.

星光不落少年眉 2024-08-30 15:17:59

计数排序:http://en.wikipedia.org/wiki/Counting_sort 如果你的整数相当小的。
如果您有更大的数字,则进行基数排序(这基本上是计数排序的概括,或者如果您愿意的话,可以对更大的数字进行优化): http://en.wikipedia.org/wiki/Radix_sort

还有桶排序:http://en.wikipedia.org/wiki/Bucket_sort

Counting sort: http://en.wikipedia.org/wiki/Counting_sort if your integers are fairly small.
Radix sort if you have bigger numbers (this is basically a generalization of counting sort, or an optimization for bigger numbers if you will): http://en.wikipedia.org/wiki/Radix_sort

There is also bucket sort: http://en.wikipedia.org/wiki/Bucket_sort

瀞厅☆埖开 2024-08-30 15:17:59

这些基于硬件的排序算法:

无比较排序算法
硬件中的二进制数排序 - 一种新颖的算法及其实现

激光多米诺排序算法 - 我基于意图计数排序的思想实验与计数排序的 O(n + k) 相比,实现了 O(n) 时间复杂度。

These hardware-based sorting algorithms:

A Comparison-Free Sorting Algorithm
Sorting Binary Numbers in Hardware - A Novel Algorithm and its Implementation

Laser Domino Sorting Algorithm - a thought experiment by me based on Counting Sort with an intention to achieve O(n) time complexity over Counting Sort's O(n + k).

魂牵梦绕锁你心扉 2024-08-30 15:17:59

虽然不是很实用(主要是由于内存开销很大),但我想我会提到 算盘(珠子)排序 作为另一个有趣的线性时间排序算法。

While not very practical (mainly due to the large memory overhead), I thought I would mention Abacus (Bead) Sort as another interesting linear time sorting algorithm.

桜花祭 2024-08-30 15:17:59

接受的答案不是有效的 O(n) 排序,因为它是 O(n+k) 排序算法。

你应该看看斯大林排序

the accepted answer is not a valid O(n) sort as far as it is a O(n+k) sorting algorithm.

You should have a look at the Stalin Sort

岁月打碎记忆 2024-08-30 15:17:59

添加更多细节 - 实际上迄今为止最好的排序算法不是 O(n),而是 O(n √(log log n)) 预期时间。

您可以在Yijie Han & 中查看有关该算法的更多详细信息。 Mikkel Thorup 的 FOCS '02 论文

Adding a little more detail - Practically the best sorting algorithm till date is not O(n), but O(n √(log log n)) expected time.

You can check more details about this algorithm in Yijie Han & Mikkel Thorup's FOCS '02 paper.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文